Archive for December, 2010

Cannot delete or update a parent row: a foreign key constraint fail

Saturday, December 25th, 2010

To delete a table that has a foreign key constraint, you will get the following error.

Cannot delete or update a parent row: a foreign key constraint fail

You can temporarily disable the foreign key referential check by the following command.

SET foreign_key_checks = 0;
drop table xxx;
SET foreign_key_checks = 1;