SQL Error 1005

drbowen wrote on Thursday, November 22, 2012:

I am currently dumping my datababase to restore to a second test instance of OpenEMR.  During the restore:

mysql -u root -p bpuc_testing < openemr.sql

I get the following error:

ERROR 1005 (HY000) at line 251: Can’t create table ‘bpuc_testing.automatic_notification’ (errno: 121)

References to this error code state that this means there is no primary index on the table being created.

Looking at the table ‘automatic_notification’ there appears to a primary key on notification_id.

Keyname: PRIMARY
Type: PRIMARY
Cardinality: 2
Field: notification_id

I have repeated this and get the same error.

Additional possible solutions are to log in to mysql cli and run:

SHOW ENGINE INNODB STATUS\G

looking for:

LATEST FOREIGN KEY ERROR

There are no foreign key erros listed.

Not sure what is causing this error.  Are there any ideas?

Sam Bowen, MD
OEMR, executive director

drbowen wrote on Thursday, November 22, 2012:

OpenEMR 4.1.1
CENTOS 6.3
Apache/2.2.15
mysql 5.1.66
PHP 5.4.8

yehster wrote on Friday, November 23, 2012:

How did you generate the dump?  Did you do it from the command line or did you use OpenEMR or phpMyAdmin?  If it wasn’t from the command line, I’d try that.  If it was from the command line, then suggest you try dumping just the one table and seeing if you that produces better results.