MySQL Constraints: Import
Posted: 10 Mar 2015, 2:09am - Tuesday

I stumbled down again of database constraints when importing SQL dump file.

ERROR 1217 (23000) at line 128: Cannot delete or update a parent row: a foreign key constraint fails
The solution is add the following line in the beginning of the SQL dump file:
SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0
That should work.