Home > Database > Mysql Tutorial > body text

mysql删除条目报错Cannot delete or update a parent row: a

WBOY
Release: 2016-06-07 16:41:42
Original
2921 people have browsed it

在SQLyog中删除条目出现Cannot delete or update a parent row: a foreign key constraint fails 原因是MySQL在InnoDB中设置了foreign key关联,造成无法更新或删除数据。 如果需要强制删除可以做如下操作: SET FOREIGN_KEY_CHECKS = 0; 执行上面的语句后就

在SQLyog中删除条目出现Cannot delete or update a parent row: a foreign key constraint fails
原因是MySQL在InnoDB中设置了foreign key关联,造成无法更新或删除数据。
如果需要强制删除可以做如下操作:
SET FOREIGN_KEY_CHECKS = 0;
执行上面的语句后就可以删除了,删除之后为了确保数据库的之前的设置正确别忘记
SET FOREIGN_KEY_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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!