Monday, August 27, 2012

MySQL Error while dropping tables: Cannot delete or update a parent row: a foreign key constraint fails

If you know what you are doing and you still want to drop a table containing foreign constraints, then you need to follow this procedure:

SET FOREIGN_KEY_CHECKS=0;
DROP TABLE t1;
SET FOREIGN KEY_CHECKS=1;
Post a Comment