Developer on Alibaba Coud: Build your first app with APIs, SDKs, and tutorials on the Alibaba Cloud. Read more ＞
Recently has been tossing VPS, just encountered in the process of moving WordPress Import database. Ran into
#1062 –duplicate entry ' 1′for key ' PRIMARY '
At that time the urgent ah, the original data I have all deleted, there is no way only to request the almighty Baidu. I looked for more than half a day to finally find me. Excited ing, immediately tested, O (∩_∩) o haha ~ succeeded.
Now attached to the solution as long as the original old data empty import on it.
Principle I do not understand, put it up and see for yourselves. Anyway, it's OK to achieve the goal.
"Tip #1062–duplicate entry ' 1′for key ' PRIMARY ', later know, the original last exceeded the limit has been a part of the guide, and ID is the primary key, can not be the same, so it is not, the old data are deleted, you can again guide. ”
Thanks also to the blogger for publishing the solution. Or else I'll be in trouble.
The problems encountered today are very simple, but also very common, make a note here:
The data from a machine to another machine, so there are too many records, just at the beginning did not notice, more than the phpmyadmin limit, prompted a mistake, I put the file manually into small files, but then prompted #1062-duplicate entry ' 1 ' for key ' PRIMARY ', later know, the original last exceeded the limit has been a part of the guide, and ID is the primary key, can not be the same, so it is not, the old data are deleted, you can again guide.
All right. If you have the same problem as me, try it now. No, I don't know.
MySQL data backup, restore after the reply, the following error code appears:
discuz! Info:mysql Query Error
Online Search Analysis reasons:
It is possible that the field PID is primary key and the Auto_increment property cannot have duplicate values.
While I was backing up the data, there might be data writes that corrupted the datasheet.
Some methods were tried:
1. data table partial field property loss ALTER table ' cdb_posts ' change ' pid ' pid ' INT (a) UNSIGNED not NULL auto_increment
2, Repair table cdb_posts
The Final Solution:
Usually because of the data table file damage caused by the use of the MySQL Repair tool myisamchk tool repair.
Fixing the datasheet is OK!
This article is an English version of an article which is originally in the Chinese language on aliyun.com and is provided for information purposes only. This website makes no representation or warranty of any kind, either expressed or implied, as to the accuracy, completeness ownership or
reliability of the article or any translations thereof. If you have any concerns or complaints relating to the article, please send an email, providing a detailed description of the concern or
complaint, to email@example.com. A staff member will contact you within 5 working days. Once verified, infringing content will be removed immediately.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
and provide relevant evidence. A staff member will contact you within 5 working days.