MySql数据库插入或更新报错:Cannot add or update a child row: a foreign key constraint fails
具体报错信息:
Cannot add or update a child row: a foreign key constraint fails (`xxx`.`AAA`, CONSTRAINT `tb_competitionmsg_ibfk_2` FOREIGN KEY (`organizerid`) REFERENCES `BBB` (`id`))
报错信息分析:
XXX数据库中的 AAA表 中的 organizerid字段 是BBB表中的id的外键,但是要插入的organizerid值在id中没有匹配成功。
解决:
检查插入的数据是否正确
在BBB表中的id字段中添加上所要插入的值。
MySql数据库插入或更新报错:Cannot add or update a child row: a foreign key constraint fails的更多相关文章
- MySQL设置外键报错 #1452 - Cannot add or update a child row: a foreign key constraint fails 解决方法
MySQL数据库,当我尝试在A表中设置B表的主键为外键时,报出错误:#1452 - Cannot add or update a child row: a foreign key constraint ...
- Mysql数据库报错:Cannot add or update a child row: a foreign key constraint fails(添加多对多关系)
#创建班级表 class Classes(models.Model): title = models.CharField(max_length=32) n=models.ManyToManyField ...
- admin添加用户时报错:(1452, 'Cannot add or update a child row: a foreign key constraint fails (`mxonline`.`django_admin_l
在stackoverflow找到答案: DATABASES = { 'default': { ... 'OPTIONS': { "init_command": "SET ...
- 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 ...
- 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 ...
- 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 ...
- Mysql - 删除表时出现: 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 ...
- 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 ...
- 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 这个该如何解决 可以这样解决: S ...
随机推荐
- Java并发编程:JMM和volatile关键字
转载请标明出处: http://blog.csdn.net/forezp/article/details/77580491 本文出自方志朋的博客 Java内存模型 随着计算机的CPU的飞速发展,CPU ...
- SpringBoot非官方教程 | 第十二篇:springboot集成apidoc
转载请标明出处: 原文首发于:https://www.fangzhipeng.com/springboot/2017/07/11/springboot-apidoc/ 本文出自方志朋的博客 首先声明下 ...
- Alert Log删除
标题:Renaming or Deleting the Alert Log While an Oracle Instance is Up & Running (文档 ID 74966.1) Q ...
- iOS之UIImagePickerController显示中文界面
iOS开发中,我们经常遇到获取拍照.相册中图片的功能,就必然少不了UIImagePickerController,但是我们发现当我们使用它的时候,它的页面是英文的,看着很别扭,国人还是比较喜欢看中文界 ...
- call、apply和bind的用法
在改变 this 指向的时候,经常会把这三个方法混淆,下面就详细的整理一下三者的用法和区别 call() 方法 call() 方法可以有无数个参数 第一个参数是改变 this 指向的对象 后面的参数直 ...
- Eclipse build时间太长,无法忍受,完美解决方案,Eclipse 编译太卡,耗时太长
目前开发使用了Eclipse ,每次报错的时候都会build,,每次build的时间都很长,接近10秒左右,好难受呀.. 刚开始一直以为是项目内容多导致的,但是想想之前做的项目,无论再多,也都是秒级的 ...
- CentOS查看占用端口并关闭
1.查看占用的端口号 netstat -lnp|grep 80 #80 是你需要查看的端口号 二.查看进程的详细信息 ps 29280 #查看进行信息,是否是自己要找的进程 三.杀掉进程 kill ...
- 【cisco探索之路】
CISCO探索之路 show&debug&clear 1:show show version:显示版本信息show running-config:显示当前的配置show interfa ...
- connect() to unix:/var/run/php-fpm.sock failed (11: Resource temporarily unavailable)
nginx + php做服务,在高并发的时候会出现一些错误 connect() to unix:/var/run/php-fpm.sock failed (11: Resource temporar ...
- Hadoop(4)-Hadoop集群环境搭建
准备工作 开启全部三台虚拟机,确保hadoop100的机器已经配置完成 分发脚本 操作hadoop100 新建一个xsync的脚本文件,将下面的脚本复制进去 vim xsync #这个脚本使用的是rs ...