key

If you encounter the error “Cannot add or update a child row: a foreign key constraint fails” when you import a MySQL dump file, you can bypass the foreign key checks by setting the following line at the top of your MySQL dump file:

SET foreign_key_checks = 0;

Note that the line should be put before any other SQL query in the dump. Save the file and try to import it once again. This time it should be imported silently.

If you are proficient in the SQL, you might try and suggest other alternative solutions.

A short update:

The above solution might be rough and not well working. If you experience troubles and errors after the import, you can try to replace the above line with: