How to avoid MySQL to check foreign keys when creating a database from a dump script? I have a MySQL dump file and I want to create a database from it. It's a very large file (1.3 GB) and I know it will take a lot of time to be ready.
But I'm having problem with the constraint check, because when it attempt to create a table, it cannot found the parent table. I added a SET FOREIGN_KEY_CHECKS = 0 at the beginning of the script and a SET FOREIGN_KEY_CHECKS = 1 at the end, but it still doesn't work. I get a ERROR 1005 (HY000).
Why is this happening? Shouldn't SET FOREIGN_KEY_CHECKS = 0 tell MySQL to avoid checking if the parent table exists? What can I do? This script creates 158 tables and I cannot change the order to avoid this error, the file has over 10,000,000 lines!
Any suggestions? Thanks a lot! |