【转】Cannot add or update a child row: a foreign key constraint fails 解决办法
原因:
设置的外键和对应的另一个表的主键值不匹配。
解决方法:
找出不匹配的值修改。
或者清空两表数据。
转自https://blog.csdn.net/qq_29405421/article/details/53907702
【转】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 ...
- 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 ...
- 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`.` ...
- 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 ...
- 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 ...
- 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 ...
- 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 错误产生情景:我向一张带外键 ...
- 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 ...
- hibernate4一对多关联多方多写一次外键导致无法创建java.lang.NullPointerException以及Cannot add or update a child row: a foreign key constraint fails
一篇文章里边有多张图片,典型的单向一对多关系 多方 当程序运行到这一句的时候必然报错 但是参考书也是这样写的 其中em是 EntityManager em = JPA.createEntityMana ...
随机推荐
- 02-nginx信号量
刚才完了nginx的编译,nginx的编译还是挺简单的.控制nginx:重启.关闭.只有孤零零的一个二进制文件nginx 通过信号来控制它,Linux操作系统进程与进程之间通过信号来通信.荷兰的一位计 ...
- 值得一做》一道类似于货车运输的题目(BZOJ3732)(easy+)
这是一道模板套模板的题目,只要会LCA和最小生成树就可以做,水题 直接先甩题目 Description 给你N个点的无向图 (1 <= N <= 15,000),记为:1…N. 图中有M条 ...
- 配置SecureCRT连接VirtualBox虚拟机中的Linux环境
在实际的运维中我们常常使用SecuriteCRT来远程控制Linux服务器.下面将详细介绍windows 7下通过VirtualBox搭建linux开发环境,并最终通过SecurityCRT来远程访问 ...
- C# ShowDialog时窗体贱传值得方法
用C#开发应用的时候,通常需要多个窗体!有时候为了打开窗体的时候禁止操作父窗体,我们一般采用模态对话框的方法,也算就是用ShowDialog()方法. 假设有两个窗体A和B,A作为主窗体使用ShowD ...
- 238. Product of Array Except Self 由非己元素形成的数组
[抄题]: Given an array of n integers where n > 1, nums, return an array output such that output[i] ...
- 关于for循环的一个小问题
有如下程序: package com.lk.B; public class Test5 { public static void main(String[] args) { // TODO Auto- ...
- 互联网+大数据解决方案(ppt)
from: 互联网+大数据解决方案(ppt) 导读:大数据(bigdata),或称巨量资料,指的是所涉及的资料量规模巨大到无法透过目前主流软件工具,在合理时间内达到撷取.管理.处理.并整理成为帮助企业 ...
- 清除Vs2010的工作区影射关系的缓存信息的文件夹路径
C:/Users/Administrator/AppData/Local/Microsoft/Team Foundation/3.0/Cache
- Python基础入门-实现猜数字小游戏
今天呢,我们来通过前面学过的一些知识点来完成一个猜数字大小的游戏程序设计.那么呢,一般人写代码直接上来就干,没有分析,这样的做法是没有产出的,除非你是大牛,今天呢,我会把我学习编程的思路分享给大家,我 ...
- 【Android学习】实现卡片式ListView
效果: 主要是设置xml文件 两种状态下的item card_background.xml <?xml version="1.0" encoding="utf-8& ...