Tag Archives: key

MySQL: delete a row ignoring foreign key constraint

Cannot delete or update a parent row: a foreign key constraint fails 
DELETE IGNORE FROM `database`.`table` WHERE `table`.`tableId` = 16 LIMIT 1;

The IGNORE keyword causes MySQL to ignore all errors during the process of deleting rows. (Errors encountered during the parsing stage are processed in the usual manner.) Errors that are ignored due to the use of IGNORE are returned as warnings.

http://dev.mysql.com/doc/refman/5.0/en/delete.html