Home > Database > Mysql Tutorial > mysql 出现Cannot delete or update a parent row:_MySQL

mysql 出现Cannot delete or update a parent row:_MySQL

WBOY
Release: 2016-06-01 13:08:33
Original
1543 people have browsed it

当在Mysql下删除有一个建有外键的表的数据时可能会报此异常,所以可以启动MySql命令行模式,运行如下的sql语句来关闭外键检测:

SET FOREIGN_KEY_CHECKS = 0;

执行你要的操作后把再把外键检测恢复

SET FOREIGN_KEY_CHECKS = 1;

其他相关的有:

关闭唯一性校验

set unique_checks=0;

set unique_checks=1;

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template