mysql error #1005 - Can't create table (errno: 150) importing database from another server

http://stackoverflow.com/questions/9018584/error-code-1005-cant-create-table-errno-150/30102503#30102503
Reference link to stackoverflow

This could also happen when exporting your database from one server to another and the tables are listed in alphabetical order by default.
So, your first table could have a foreign key of another table that is yet to be created. In such cases, disable foreign_key_checks and create the database.
Just add the following to your script:

vim export.sql

use  databasename100;
SET FOREIGN_KEY_CHECKS=0;
..
..
...sql'sss ....

and it shall work.



No comments:

Post a Comment