ERROR 1217 (23000) at line 287: Cannot delete or update a parent row: a foreign key constraint fails

ERROR 1217 (23000) at line 287: Cannot delete or update a parent row: a foreign key constraint fails

If you got this error, it means that you are trying to restore a database sql file which got dependancy on other tables.

To override and restore anyway, add this to the top of the .sql dump file

SET FOREIGN_KEY_CHECKS = 0;

This will make sure that the foreign key checks are disabled for the session while restoring.

Leave a Reply

Your email address will not be published. Required fields are marked *