This article shares an article about the solution to mysql Error: Duplicateentryxxxxforkey1. If you have any questions, please refer to it.
This article will share a solution for mysql Error: Duplicate entry xxxx for key 1. If you have any questions, please refer to it.
The error format is as follows:
Discuz! Info: MySQL Query Error
User: Love Me Jingmen
Time: am
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', 'Love Jingmen ', '5', 'fg', '123 ', '123', 'Love Jingmen ', '0', '0', '0', '0', '0', '0', '0 ', '0 ')
Error: Duplicate entry '000000' for key 1
Errno.: 1062
Similar error report has beed dispatched to administrator before.
Then I opened the MYSQL manual and found the description of TINYINT, SMALLINT, and INT types:
TINYINT [(M)] [UNSIGNED] [ZEROFILL]
A small integer. The signed range is-128 to 127, and the unsigned range is 0 to 255.
SMALLINT [(M)] [UNSIGNED] [ZEROFILL]
A small integer. The signed range is-32768 to 32767, And the unsigned range is 0 to 65535.
MEDIUMINT [(M)] [UNSIGNED] [ZEROFILL]
An integer of medium size. The signed range is-8388608 to 8388607, And the unsigned range is 0 to 16777215.
INT [(M)] [UNSIGNED] [ZEROFILL]
A normal integer. The signed range is-2147483648 to 2147483647, And the unsigned range is 0 to 4294967295.
INTEGER [(M)] [UNSIGNED] [ZEROFILL]
This is a synonym for INT.
BIGINT [(M)] [UNSIGNED] [ZEROFILL]
A large integer. The signed range is-9223372036854775808 to 9223372036854775807, And the unsigned range is 0
18446744073709551615.
So it turns out!
That's why other Invalid Query: Duplicate entry '000000' for key 1 errors on the Internet!
Now we have found a solution for server upgrade.
Alter table 'cdb _ posts' CHANGE 'pid ''pid 'INT (10) unsigned not null default '0' AUTO_INCREMENT;