Restoring backup fails

I’m running certified-asterisk-1.8.15-cert1 on centos 6.4. I’m trying to restore from backup and I’m getting this error:

130709 7:52:07 InnoDB: Error: table `asterisk`.`backup` already exists in InnoDB internal InnoDB: data dictionary. Have you deleted the .frm file InnoDB: and not used DROP TABLE? Have you used DROP DATABASE InnoDB: for InnoDB tables in MySQL version <= 3.23.43? InnoDB: See the Restrictions section of the InnoDB manual. InnoDB: You can drop the orphaned table inside InnoDB by InnoDB: creating an InnoDB table with the same name in another InnoDB: database and copying the .frm file to the current database. InnoDB: Then MySQL thinks the table exists, and DROP TABLE will InnoDB: succeed. InnoDB: You can look for further help from InnoDB: http://dev.mysql.com/doc/refman/5.1/en/innodb-troubleshooting.html

The backup was made from another system running the same version.

Here’s what I see in the FreePBX web ui:

Intialized!! Intializing Restore... Running pre-restore hooks, if any... Restoring files... File restore complete! Restoring settings... Getting Settings size... [FATAL] CREATE TABLE `backup` ( `id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(50) DEFAULT NULL, `description` varchar(150) DEFAULT NULL, `immortal` varchar(25) DEFAULT NULL, `data` longtext, PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1; [nativecode=1005 ** Can't create table 'asterisk.backup' (errno: 121)]

Trace Back:

: die_freepbx()
[0]: CREATE TABLE backup (
id int(11) NOT NULL AUTO_INCREMENT,
name varchar(50) DEFAULT NULL,
description varchar(150) DEFAULT NULL,
immortal varchar(25) DEFAULT NULL,
data longtext,
PRIMARY KEY (id)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1; [nativecode=1005 ** Can’t create table ‘asterisk.backup’ (errno: 121)]

/var/www/html/admin/libraries/sql.functions.php:116 call_user_func()
[0]: die_freepbx
[1]: CREATE TABLE backup (
id int(11) NOT NULL AUTO_INCREMENT,
name varchar(50) DEFAULT NULL,
description varchar(150) DEFAULT NULL,
immortal varchar(25) DEFAULT NULL,
data longtext,
PRIMARY KEY (id)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1; [nativecode=1005 ** Can’t create table ‘asterisk.backup’ (errno: 121)]

/var/www/html/admin/modules/backup/bin/restore.php:264 db_e()
[0]: DB Error: can not create

Info in the database:

mysql> use asterisk; use asterisk; Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -A

Database changed
mysql> show tables;
show tables;
±------------------------+
| Tables_in_asterisk |
±------------------------+
| admin |
| ampusers |
| backup_cache |
| backup_details |
| backup_items |
| backup_server_details |
| backup_servers |
| backup_template_details |
| backup_templates |
| callrecording |
| callrecording_module |
| cidlookup |
| cidlookup_incoming |
| cronmanager |
| custom_destinations |
| custom_extensions |
| dahdi |
| devices |
| extensions |
| featurecodes |
| findmefollow |
| freepbx_log |
| freepbx_settings |
| globals |
| iax |
| incoming |
| ivr_details |
| ivr_entries |
| meetme |
| module_xml |
| modules |
| notifications |
| outbound_route_patterns |
| outbound_route_sequence |
| outbound_route_trunks |
| outbound_routes |
| recordings |
| sip |
| sipsettings |
| timeconditions |
| timegroups_details |
| timegroups_groups |
| trunk_dialpatterns |
| trunks |
| users |
| zap |
| zapchandids |
±------------------------+
47 rows in set (0.01 sec)

mysql>

I would appreciate help. Thanks.

The problem was that I had lingering freepbx stuff around and the mysql database was messed up. I decided to wipe all the mysql dbs and start over, which got up over the hump.