VPs has been around for a long time. I just encountered importing a database during the WordPress migration process. Met
#1062-duplicate entry '1' for key 'primary'
At that time, I was so anxious that I had deleted all the original data and could not only request the omnipotent Baidu. I finally found it for me for a long time. Excited ing, test now, O (lead _ Wait) O Haha ~ Succeeded.
Now we have attached a solution to clear the old data and import it.
I don't understand how it works. paste it here for yourself. It's okay to achieve the goal anyway,
"Prompt #1062-duplicate entry '1' for key 'primary'. Later, I realized that the previous time that exceeds the limit, I imported a part, and ID is the primary key, it cannot be the same, so it won't work. If you delete all the old data, you can re-import it."
I would like to thank the blogger for providing the solution. Otherwise, I will be in trouble.
The problem we encountered today is very simple, but it is also very common. Make a record here:
The data is exported from one machine to another, so there are too many records. I didn't pay attention to it at the beginning. The phpMyAdmin limit is exceeded and an error is prompted, I manually divided the file into some small files, but the prompt #1062-duplicate entry '1' for key 'Primary 'is displayed after being imported, it turns out that some of the previously exceeded restrictions have been imported, and the ID is the primary key, which cannot be the same, so it will not work. If you delete all the old data, you can re-import it.
Okay. If you have encountered the same problem as me, try it now. I don't know if I don't try.
MySQL backs up data and replies after restoration. The following error occurs:Code:
Discuz! Info: MySQL query Error
SQL: insert into [Table] posts (FID, tid, first, author, authorid, subject, Dateline, message, useip, invisible, anonymous, usesig, htmlon, bbcodeoff, smileyoff, parseurloff, attachment)
Values ('45', '20170', '0', 'webrule', '6', '', '123', 'ddd ', '123. 168.253.1 ', '0', '0', '0', '0','-1', '-1', '', '0 ')
Error: duplicate entry '000000' for key 1
Reasons for online search analysis:
It may be because the PID of the field is the primary key and the auto_increment attribute cannot contain duplicate values.
When I back up data, some data may be written to the damaged data table.
Tried Some methods:
1. Lost alter table 'cdb _ posts' change 'pid ''pid 'int (10) unsigned not null auto_increment
2. Repair table cdb_posts
it is generally caused by damage to data table files. You can use the MySQL Repair Tool myisamchk to fix the problem.
fix the data table!