Integrity constraint violation: 1062 Duplicata du champ '0' pour la clef 'PRIMARY'解决方法
来源:互联网 发布:淘宝虾米vip兑换码激活 编辑:程序博客网 时间:2024/05/22 03:08
Integrity constraint violation – yii\db\IntegrityException
SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicata du champ '0' pour la clef 'PRIMARY'
The SQL being executed was: INSERT INTO `equipment` (`equi_name`, `equi_SN`, `equi_intro`, `equi_state`, `equi_place`, `addtime`, `code`) VALUES ('1', '1', '1', '1', '1', '1457513867', '1')
Error Info: Array
(
[0] => 23000
[1] => 1062
[2] => Duplicata du champ '0' pour la clef 'PRIMARY'
)
网上找到的解决方法,进入http://localhost/phpmyadmin,把对应的表的所有数据删除即可
但这是治标不治本的方法并且也不合理,经过检查,我是因为在设计数据库的表的primary key的时候,没有设置AUTO-INCREMENT,导致插入新纪录时出现重复值。通过phpmyadmin修改即可。如下:
若您也出现了这种情况,不妨检查一下设计数据库表时,是否出错了。
1 2
- Integrity constraint violation: 1062 Duplicata du champ '0' pour la clef 'PRIMARY'解决方法
- SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '5-47' for key 'PRIMARY'
- A referential integrity constraint violation occurred BUG修复
- Integrity constraint violation: 1052 Column "order_id" in where clause is ambiguous
- 报错:Duplicate key or integrity constraint violation message from server
- Integrity constraint violation: 1052 Column 'id' in order clause is ambiguou
- Yii报错:SQLSTATE[23000]: Integrity constraint violation: 1052 Column 'id' in order clause is ambiguous
- SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'customer' cannot be null
- 操作MySQL报出: Duplicate key or integrity constraint violation message from server 问题解决
- Integrity constraint violation: 1052 Column 'status' in where clause is ambiguous
- loader constraint violation错误
- java.sql.BatchUpdateException: ORA-02291: integrity constraint
- ORA-02292:integrity constraint(xx) violated
- NTDLL.DLL): 0xC0000005: Access Violation-解决方法
- java.lang.LinkageError: loader constraint violation
- java.lang.LinkageError: loader constraint violation
- java.lang.LinkageError: loader constraint violation解决
- java.lang.LinkageError: loader constraint violation
- 千里之行 始于足下
- 计算机网络之体系结构
- Codeforces 630F:Selection of Personnel【数列组合】
- Linux抓包工具tcpdump详解
- Android studio问题汇总
- Integrity constraint violation: 1062 Duplicata du champ '0' pour la clef 'PRIMARY'解决方法
- VNC无法调出图形界面
- Android WebView初体验
- 3xian之所在(3xian退役贴)
- CoreData 深入理解6 Mapping Model
- kafka manager安装
- 移动html特殊链接:打电话,发短信,发邮件
- GPRS-SIM900模块应用程序——发短信打电话
- flask web 应用部署