标签:class blog code http tar ext
SQL 查询:
DELETE FROM `zmax_lang` WHERE CONVERT( `zmax_lang`.`lang` USING utf8 ) = ‘fr‘ LIMIT 1
#1451 - Cannot delete or update a parent row: a foreign key constraint fails (`myreview/zmax_text`, CONSTRAINT `zmax_text_ibfk_1` FOREIGN KEY (`lang`) REFERENCES `zmax_lang` (`lang`))
以上是因为,改条记录的某个字段作为innodb的另外一个表的外链。而在删除操作时会自动检查外链。解决的办法之一是,不检查外链,只需将执行语句前加上下句即可:
SET FOREIGN_KEY_CHECKS = 0;
DELETE FROM `zmax_lang` WHERE CONVERT( `zmax_lang`.`lang` USING utf8 ) = ‘fr‘ LIMIT 1
【转】 #1451 - Cannot delete or update a parent row: a foreign key constraint fails 问题的解决办法
标签:class blog code http tar ext
原文地址:http://www.cnblogs.com/csshaw/p/3807962.html