转载地址:http://blog.csdn.net/donglynn/article/details/17056099

错误

SQL 查询:

DELETE FROM `zmax_lang` WHERE CONVERT( `zmax_lang`.`lang` USING utf8 ) = 'fr' LIMIT 1

MySQL 返回:

#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 问题的解决办法的更多相关文章

  1. 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 问题的解决办法查询:DELETE ...

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

    今天使用delete语句删除一张表中的一条信息时,提示了这么一个错误:1451 - Cannot delete or update a parent row: a foreign key constr ...

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

    mysql> SET FOREIGN_KEY_CHECKS = 0; Query OK, 0 rows affected (0.02 sec)   mysql> delete from r ...

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

    centos7.5 删除表空间文件失败 问题: mysql> alter table country discard tablespace; ERROR 1451 (23000): Cannot ...

  5. 【转】表删除时 Cannot delete or update a parent row: a foreign key constraint fails 异常处理

    转载地址:http://lijiejava.iteye.com/blog/790478 有两张表,结构如下: t_item:                          t_bid: id    ...

  6. 表删除时 Cannot delete or update a parent row: a foreign key constraint fails 异常处理

    有两张表,结构如下: t_item:                          t_bid: id        int                     id        int n ...

  7. MySQL主从复制中断,报“Error on master: message (format)='Cannot delete or update a parent row: a foreign key constraint fails' error code=1217” 错误

    前几天,发现从库挂了,具体报错信息如下: 分析思路 1. 因为我采用的是选择性复制,只针对以下几个库进行复制: card,upay,deal,monitor,collect.所以,不太可能出现对于sa ...

  8. Hibernate级联删除时:Cannot delete or update a parent row: a foreign key constraint fails异常

    在删除主表数据时,报了一个异常 Cannot delete or update a parent row: a foreign key constraint fails 原因是主表中还包含字表的数据, ...

  9. MySQL:ERROR 1217 (23000): 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 constraint fa ...

随机推荐

  1. hadoop Error: JAVA_HOME is not set and could not be found.

    Hadoop安装完后,启动时报Error: JAVA_HOME is not set and could not be found.解决办法:        修改/etc/hadoop/hadoop- ...

  2. 修改wamp默认网站目录

    使用WAMP集成环境,如何更改web根目录 做php开发使用WAMP集成环境的同学大部分有过这样的经历: 如果你试图修改web根目录,那么你肯定会想到要修改apache/apache2.2.11/co ...

  3. POJ 1195 二维树状数组

    Mobile phones Time Limit: 5000MS   Memory Limit: 65536K Total Submissions: 18489   Accepted: 8558 De ...

  4. 2016HUAS暑假集训训练题 E - Rails

    There is a famous railway station in PopPush City. Country there is incredibly hilly. The station wa ...

  5. SpringMVC下的Shiro权限框架的使用

    SpringMVC+Shiro权限管理 博文目录 权限的简单描述 实例表结构及内容及POJO Shiro-pom.xml Shiro-web.xml Shiro-MyShiro-权限认证,登录认证层 ...

  6. js 获取控制台的错误信息

    适合移动端调试的时候优化的报错使用.缺点是无法打印出多条记录,有方法的同学留言告诉我. <!DOCTYPE html> <html lang="en"> & ...

  7. 解决:Could not parse response code.Server Reply: SSH-2.0-OpenSSH_5.3

    [摘要:办理:org.apache.commons.net.MalformedServerReplyException: Could not parse response code.Server Re ...

  8. The Earth Mover's Distance

    The EMD is based on the minimal cost that must be paid to transform one distribution into the other. ...

  9. 自己用node.js 搭建APP服务器,然后用AFNetworking 请求 报如下错误:App TransportSecurity has blocked a cleartext HTTP (http://) resource load since it isinsecure. Temporary exceptions can be configured via your app's Info.

    "App TransportSecurity has blocked a cleartext HTTP (http://) resource load since it isinsecure ...

  10. 获取 Cookie

    /// <summary>    /// 获取WPF url 地址中的Cookies    /// </summary>    public partial class Coo ...