mysql报错 a foreign key constraint fails(外键约束错误)
报错信息如下:
(pymysql.err.IntegrityError) (1452, u'Cannot add or update a child row: a foreign key constraint fails
解决办法:
SET FOREIGN_KEY_CHECKS = 0; # 临时取消外键约束
SET FOREIGN_KEY_CHECKS = 1; # 开启外键约束
添加之前临时取消一下外键约束,添加好数据之后,再将外键约束改回来就可以啦!
mysql报错 a foreign key constraint fails(外键约束错误)的更多相关文章
- 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设置外键报错 #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
具体报错信息: Cannot add or update a child row: a foreign key constraint fails (`xxx`.`AAA`, CONSTRAINT `t ...
- 删除带外键的表【foreign key constraint fails】报错
title: 删除带外键的表[foreign key constraint fails]报错 date: 2018-08-02 21:59:06 tags: 数据库 --- 遥想当时正在学hibern ...
- 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删除有外链索引数据Cannot delete or update a parent row: a foreign key constraint fails 问题的解决办法查询:DELETE ...
- 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在删除一张表时出现 ERROR 1217 (23000): Cannot delete or update a parent row: a foreign key constraint ...
- 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 ...
- a foreign key constraint fails
今天遇到一个问题,一对一级联保存时,报错如下: Cannot add or update a child row: a foreign key constraint fails 解决方法: MySQL ...
随机推荐
- Schedulerx2.0支持应用级别资源管理和任务优先级
1. 前言 Schedulerx2.0是一套分布式的任务调度+计算框架.作为一套分布式计算引擎,用户经常需要资源管理的需求,当前schedulerx仅仅支持单个任务实例的管控(比如单机子任务并发数.拉 ...
- [FAQ] SSH 免密登录主机/服务器 怎么操作 ?
1. 生成公私钥对,保存好. 命令:ssh-keygen -t rsa -C "xxx" 2. 将公钥传到远程主机的 ~/.ssh/authorized_keys 之中. 命令:s ...
- WPF 已知问题 dotnet 6 设置 InvariantGlobalization 之后将丢失默认绑定转换导致 XAML 抛出异常
在设置了 InvariantGlobalization 为 true 之后,将会发现原本能正常工作的 XAML 可能就会抛出异常.本文将告诉大家此问题的原因 这是有开发者在 WPF 仓库上给我报告的 ...
- K8s应用---配置管理中心configmap和Secret(13)
一.Configmap概述 1.1 什么是configmap Configmap 是 k8s 中的资源对象,用于保存非机密性的配置的,数据可以用 key/value 键值对的形式保存,也可通过文件的形 ...
- Jenkins+Harbor+gogs+docker+portainer+springboot实现devOps(企业实战)
本篇主要讲述springboot以及vue前后端分离项目,使用Jenkins拉取gogs代码仓库源码,构建Docker镜像并推送至Harbor仓库,使用docker 可视化部署工具[portainer ...
- DB2查找最耗时SQL
两种方法:db2top和snapshot for dynamic sql 1. db2top -d <dbname>
- 跟羽夏学 Ghidra ——简述
写在前面 此系列是本人一个字一个字码出来的,包括示例和实验截图.本人非计算机专业,可能对本教程涉及的事物没有了解的足够深入,如有错误,欢迎批评指正. 如有好的建议,欢迎反馈.码字不易,如果本篇文章 ...
- linux的统计实现
场景: 将下面的数据里category里的分类统计计数 数据源 es_ip10000.json {"_index":"order","_type&qu ...
- docker安装Mysql挂载数据卷 实现容器配置本地化
目录 一.安装docker 二.docker安装MySQL 安装5.7.31版本的mysql navicat 连接mysql 安装mysql:8 三.设置开机自动启动容器 Docker快速创建MySQ ...
- Pr 的导出视频
导出视频 https://www.bilibili.com/video/BV1Vt411n7Bb?p=7