其实这句话的意思就是你添加一个值是一个外键,但是这个外键不在关联的数据库中的主键中,这样就导致了添加失败了,解决办法就是添加对应关联数据库的主键的值,不过我要提醒一下!(也就是我采的坑!)

一定要看清有几个外键,我改完一个发现还会报错,原来有TM两个外键,结果我折腾了半天,希望可以让那些看到这篇文章的人少踩一下坑!世界美好!

mysql数据库报错 sql 1452 Cannot add or update a child row:a foreign key constraint fails的更多相关文章

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

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

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

  4. java.sql.SQLIntegrityConstraintViolationException: Cannot add or update a child row: a foreign key constraint fails

    HTTP Status 500 - Request processing failed; nested exception is org.hibernate.exception.ConstraintV ...

  5. Error Code: 1452 Cannot add or update a child row: a foreign key constraint fails

    错误: Error Code: 1452 Cannot add or update a child row: a foreign key constraint fails 错误产生情景:我向一张带外键 ...

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

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

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

  9. hibernate4一对多关联多方多写一次外键导致无法创建java.lang.NullPointerException以及Cannot add or update a child row: a foreign key constraint fails

    一篇文章里边有多张图片,典型的单向一对多关系 多方 当程序运行到这一句的时候必然报错 但是参考书也是这样写的 其中em是 EntityManager em = JPA.createEntityMana ...

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

随机推荐

  1. 微服务系列之授权认证(一) OAuth 2.0 和 OpenID Connect

    1.传统架构的授权认证 传统应用架构,用户使用账号密码登录后,可以使用前端cookie存储登录状态,也可以使用后端session方式存储登录状态,小应用这么做其实很高效实用,当应用需要横向扩展时,就需 ...

  2. 如何用AR Engine开发一个虚拟形象表情包?

    现如今,人们在网上聊天.发帖时越来越爱用表情包,表情包一方面是一种个性化的表达方式,另一方面更能传达出当下的心理活动,可以说在网络社交中表情包是一个不可或缺的存在.加上近年来元宇宙的兴起,3D虚拟形象 ...

  3. 入门Python,看完这篇就行了!

    转载请注明出处️ 作者:测试蔡坨坨 原文链接:caituotuo.top/3bbc3146.html 你好,我是测试蔡坨坨. 众所周知,Python语法简洁.功能强大,通过简单的代码就能实现很多实用. ...

  4. scheduler打印状态到日志

    编辑脚本和目录 # 如下步骤每个proxysql节点都需要操作 [root@ss30 opt]# mkdir -p /opt/proxysql/log [root@ss30 opt]# vim /op ...

  5. Prometheus中使用的告警规则

    参考网站:https://awesome-prometheus-alerts.grep.to/rules 这个网站上有好多常用软件的告警规则,但是有些并不一定实用,有些使用起来会有错误,这里就把这些都 ...

  6. 在 CentOS 8/RHEL 8 上安装和使用 Cockpit

    Cockpit 是一个基于 Web 的服务器管理工具,可用于 CentOS 和 RHEL 系统.最近发布的 CentOS 8 和 RHEL 8,其中 cockpit 是默认的服务器管理工具.它的软件包 ...

  7. Linux命令系列之top——里面藏着很多鲜为人知的宝藏知识

    Linux命令系列之top--里面藏着很多鲜为人知的宝藏知识 简介 top命令是我们经常用来查看系统信息的一个指令,它提供了一个动态的而且是实时的借口帮助我们去查看系统执行时的进程.线程和系统参数的信 ...

  8. 关于aws上ec2机型的种类总结汇总

    在aws上ec2的机型是非常多的,但主要的种类为如下几种 General Purpose  (通用型)                                                 ...

  9. python 运行错误收集

    目录 global全局声明错误 global全局声明错误 SyntaxError: name 'is_login' is used prior to global declaration 解决办法:g ...

  10. 齐博X1模板页面之间的继承关系

    本节说明下模板页面间的继承 我们在前面建立了一个公共布局模板,并且利用{block name=xxx}...{/block}分割了三个部分区块 本节我们来看下模板之前的继承如何实现,首先我们建立一个i ...