今天遇到一个问题,一对一级联保存时,报错如下:

Cannot add or update a child row: a foreign key constraint fails

解决方法:

MySQL 的可视化工具里面的对应表的外键默认为不级联,改成级联之后就可以啦。

a foreign key constraint fails的更多相关文章

  1. 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 ...

  2. 【转】 #1451 - Cannot delete or update a parent row: a foreign key constraint fails 问题的解决办法

    转载地址:http://blog.csdn.net/donglynn/article/details/17056099 错误 SQL 查询: DELETE FROM `zmax_lang` WHERE ...

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

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

  4. 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 原因是主表中还包含字表的数据, ...

  5. Error 'Cannot add or update a child row: a foreign key constraint fails故障解决

    一大早的,某从库突然报出故障:SQL线程中断! 查看从库状态: mysql> show slave status\G Slave_IO_State: Waiting for master to ...

  6. 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 ...

  7. insert时报Cannot add or update a child row: a foreign key constraint fails (`yanchangzichan`.`productstatusrecord`, CONSTRAINT `p_cu` FOREIGN KEY (`cid`) REFERENCES `customer` (`cid`))错误

    mybatis在insert时报Cannot add or update a child row: a foreign key constraint fails (`yanchangzichan`.` ...

  8. IntegrityError at /admin/users/userprofile/add/ (1452, 'Cannot add or update a child row: a foreign key constraint fails (`mxonline`.`django_admin_log`, CONSTRAINT `django_admin_log_user_id_c564eba6_

    报错现象 在执行 django 后台管理的时候添加数据导致 1452 错误 报错代码 IntegrityError at /admin/users/userprofile/add/ (1452, 'C ...

  9. 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 ...

随机推荐

  1. 容器 list

    (1) 插入操作,不能使用MyTestContain.begin()+3 之类?!(要对数据进行复制) list<int>::iterator pr=MyTestContain.begin ...

  2. 用tee和script来记录终端输出

    如何在输出信息的同时把数据保存到文件当中? 一,如何把命令运行的结果保存到文件当中?这个问题太简单了,大家都知道,用 > 把输出转向就可以了 例子:[lhd@hongdi ~]$ ls > ...

  3. 复制文件时,如何显示进度条(使用TFileStream一点一点读,或者使用BlockRead)

    procedure mycopyfile(sourcef,targetf:string;i:integer); var FromF,ToF:file; NumRead,NumWritten:Integ ...

  4. c#进程间通信(Inter-Process Communication)

    原文:c#进程间通信(Inter-Process Communication) c#进程间通信(IPC, Inter-Process Communication) 接收端: using System; ...

  5. JAVA语言学校的危险性

    Java语言学校的危险性(译文) 作者: 阮一峰 日期: 2008年12月 7日 下面的文章是More Joel on Software一书的第8篇. 我觉得翻译难度很大,整整两个工作日,每天8小时以 ...

  6. Android Studio:Unable to add window android.view.ViewRootImpl$W@5e2d85a -- permission denied for this window 第一行代码

    学习<第一行代码>的时候,出现的错误. java.lang.RuntimeException: Unable to start receiver com.example.sevenun.l ...

  7. C++简介

    本文仅用于学习交流,转载请注明:http://www.cnblogs.com/mxbs/p/6266466.html  Hello,C++ World! 简介: C++融合了3中不同的编程传统:C语言 ...

  8. JMeter脚本参数化和断言设置( CSV Data Set Config )

    用Badboy录制了Jmeter的脚本,用Jmeter打开后形成了原始的脚本.但是在实际应用中,为了增强脚本的多样性,就要使脚本参数化.这里我以登录为例,参数化用户账号与用户密码.  图1 :原始脚本 ...

  9. WebSphere之wasprofile.sh使用

    概要文件(profile) 6.0版本以后才有profile,目的是将用户数据和was本身的文件分开,这样可以定义多个profile,每个profile相当于一个用户,相当于提供了多用户的支持. pr ...

  10. WebSphere配置数据库连接池

    通过WebSphere配置数据库连接池一共需要三项:     1.配置连接驱动,在这里叫:JDBC提供程序;    2.配置数据库连接池,在这里叫:配置数据源;  3.配置数据库登录帐号,密码,在这里 ...