具体报错信息:

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的更多相关文章

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

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

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

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

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

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

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

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

随机推荐

  1. Golang 字符串转URLCode

    Golang 字符串转URLCode 最近因调用gitlab API,在生成某些字符串的时候直接请求 gitlab API 失败, url如下: keysURL := "http://192 ...

  2. Java程序如何生成Jar 执行文件(2)

    一.用Eclipse生产Jar文件 注意:此方法可以打包含有第三方jar包的项目 1. 首先,右键你的Java工程,选择Export,在Java文件夹下选择Runnable JAR file,如下图所 ...

  3. 表单转换为JSON

    $.fn.serializeObject = function () { var o = {}; var a = this.serializeArray(); $.each(a, function ( ...

  4. [SHOI2015]脑洞治疗仪(恶心的线段树,区间最大子段和)

    题目描述: 曾经发明了自动刷题机的发明家 SHTSC 又公开了他的新发明:脑洞治疗仪--一种可以治疗他因为发明而日益增大的脑洞的神秘装置. 为了简单起见,我们将大脑视作一个 01 序列.11代表这个位 ...

  5. centos7下双网卡绑定

    一.进入网卡配置目录 cd /etc/sysconfig/network-scripts 二.备份原有网卡 mv ifcfg-em* /tmp/ 三.配置双网卡 nmcli con add type ...

  6. 批处理,%~d0 cd %~dp0 代表什么意思

    批处理,%~d0 cd %~dp0 代表什么意思   ~dp0 “d”为Drive的缩写,即为驱动器,磁盘.“p”为Path缩写,即为路径,目录cd是转到这个目录,不过我觉得cd /d %~dp0 还 ...

  7. Discuz论坛搜索下拉框插件openSug

    Discuz!只需安装openSug插件即可获得带有“搜索框提示”功能的搜索框,让您的Discuz搜索更便捷! 下载:https://www.opensug.org/faq/.../opensug.d ...

  8. 消费滚动滴log日志文件(flume监听,kafka消费,zookeeper协同)

    第一步:数据源 手写程序实现自动生成如下格式的日志文件: 15837312345,13737312345,2017-01-09 08:09:10,0360 打包放到服务器,使用如下命令执行,模拟持续不 ...

  9. python中的字符串(str)操作

    字符串是python中数据类型.一般就单引号(‘’)或双引号(“”)引起来的内容就是字符串. 例如:下面两个都是定义字符串 str1 = "hello world" str2 = ...

  10. (转)Updates were rejected because the tip of your current branch is behind

    刚创建的github版本库,在push代码时出错: $ git push -u origin masterTo git@github.com:******/Demo.git ! [rejected] ...