MYSQL: Cannot delete or update a parent row: a foreign key constraint fails

Posted 面具人生lql

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了MYSQL: Cannot delete or update a parent row: a foreign key constraint fails相关的知识,希望对你有一定的参考价值。


MYSQL: Cannot delete or update a parent row: a foreign key constraint fails

 

这可能是mysql在InnoDB中设置了foreign key关联,造成无法更新或删除数据。可以通过设置FOREIGN_KEY_CHECKS变量来避免这种情况。 


SET FOREIGN_KEY_CHECKS = 0; 
删除完成后设置 
SET FOREIGN_KEY_CHECKS = 1; 


其他: 
关闭唯一性校验 
set unique_checks=0; 
set unique_checks=1;

以上是关于MYSQL: Cannot delete or update a parent row: a foreign key constraint fails的主要内容,如果未能解决你的问题,请参考以下文章

Mysql之1451 - Cannot delete or update a parent row: a foreign key constraint fails...解决办法记录

mysql ERROR 1217 (23000): Cannot delete or update a parent row: a foreign key constrain fails

关于mysql中[Err] 1451 -Cannot delete or update a parent row: a foreign key constraint fails

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

VS2017 community鍒涘缓妯℃澘閿欒 The document cannot be opened. It has been renamed, deleted or moved

error while loading shared libraries: libnuma.so.1: cannot open shared object file: No such file or