0

I'm moving my Symfony app from one server to another, all is working fine but DB, I extracted the database to a bd_backup.sql file and when I try to restore the database I got this error in several tables:

ERROR 1005 (HY000): Can't create table 'mydatabase.student' (errno: 121)

the method I use is though mysql console:

mysql> use mydatabase;
mysql> source bd_backup.sql;

Is there a way to solve this? greetings!

ericksho
  • 347
  • 3
  • 12
  • 121 = foreign key error. how did you "extract" this database file? – Marc B Jun 14 '16 at 20:17
  • Old app is hosted in Heroku, I use the ClearDB backup system – ericksho Jun 14 '16 at 20:20
  • well, if that dump is a full db, and doesn't have the standard prefix commands that mysqldump inserts for you (like disabling foreign key checks), you probably have the script trying to drop a table while keys are still enabled, and you're not being allowed to create orphan records. – Marc B Jun 14 '16 at 20:22
  • How can I fix that? (sorry my noob knowledge) – ericksho Jun 14 '16 at 20:30
  • 1
    http://stackoverflow.com/questions/15501673/how-to-temporarily-disable-a-foreign-key-constraint-in-mysql – Marc B Jun 14 '16 at 20:31
  • Thanks but didn't worked, still the same error – ericksho Jun 14 '16 at 21:00

0 Answers0