Home > Database > Mysql Tutorial > body text

mysql 出现Error: Duplicate entry “xxxx” for key 1解决办法

WBOY
Release: 2016-06-07 17:51:32
Original
2945 people have browsed it

本文章分享一篇关于mysql 出现Error: Duplicate entry xxxx for key 1解决办法,有需要了解的朋友可以参考一下。

所出错形式如下:
Discuz! info: MySQL Query Error

User: 爱我荆门
Time: 2007-3-5 11:00am
Script: /bbs/post.

SQL: INSERT INTO cd12sb_threads (fid, readperm, price, iconid, typeid, author, authorid, subject, dateline, lastpost, lastposter, displayorder, digest, blog, special, attachment, subscribed, moderated, supe_pushstatus)
VALUES ('64', '0', '0', '0', '0', '爱我荆门', '5', 'fg', '1173063640', '1173063640', '爱我荆门', '0', '0', '0', '0', '0', '0', '0', '0')
Error: Duplicate entry '8181' for key 1
Errno.: 1062

Similar error report has beed dispatched to administrator before.
 

之后打开了MYSQL手册找到了TINYINT和SMALLINT和INT类型的说明:
TINYINT[(M)] [UNSIGNED] [ZEROFILL]
一个很小的整数。有符号的范围是-128到127,无符号的范围是0到255
SMALLINT[(M)] [UNSIGNED] [ZEROFILL]
一个小整数。有符号的范围是-32768到32767,无符号的范围是0到65535。
MEDIUMINT[(M)] [UNSIGNED] [ZEROFILL]
一个中等大小整数。有符号的范围是-8388608到8388607,无符号的范围是0到16777215。
INT[(M)] [UNSIGNED] [ZEROFILL]
一个正常大小整数。有符号的范围是-2147483648到2147483647,无符号的范围是0到4294967295。
INTEGER[(M)] [UNSIGNED] [ZEROFILL]
这是INT的一个同义词。
BIGINT[(M)] [UNSIGNED] [ZEROFILL]
一个大整数。有符号的范围是-9223372036854775808到9223372036854775807,无符号的范围是0到
18446744073709551615。
原来如此!
那网上其它的Invalid Query : Duplicate entry ‘32767′ for key 1出错的原因也在于此了!

现在找到办法了台升级

ALTER TABLE `cdb_posts` CHANGE `pid` `pid` INT( 10 ) UNSIGNED NOT NULL DEFAULT '0' AUTO_INCREMENT;

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!