01 April 2008

Import MySQL databases with foreign keys

When importing large MySQL databases with lots of tables that have foreign key constrains (such as in our application framework RedOne), these constraints often interfere with each other. So ...

SET FOREIGN_KEY_CHECKS = 0;

... then dump, and afterwards ...

SET FOREIGN_KEY_CHECKS = 1;

... tadaa! :)

No comments: