SQL Error 1005

Help
Sam Bowen
2012-11-22
2013-04-06
  • Sam Bowen
    Sam Bowen
    2012-11-22

    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

     
  • Sam Bowen
    Sam Bowen
    2012-11-22

    OpenEMR 4.1.1
    CENTOS 6.3
    Apache/2.2.15
    mysql 5.1.66
    PHP 5.4.8

     
  • Kevin Yeh
    Kevin Yeh
    2012-11-23

    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.