Mysqldump Lead Library error Duplicate entry "for key 1
This database backup is backed up with a backup program back in the background, more than 400 m, larger, so no phpmyadmin import, enter cmd, mysql-h localhost-u root-p database name < "Backup SQL file path", but error: Error 1062 (23000) at line 501:duplicate entry ' for key 1, and then automatically stop the import, roll back to the original state, I am!
This is what the problem caused Ah, on Baidu, on GG, also can not find a good solution, had to mysql-h localhost-u root-p database name < "Backup SQL file path" –f error will continue to import.
Search the Internet to this, first copy down, slowly study:
Error 1062 (23000) at line 501:duplicate entry ' for key 1 ERROR 1062 (23000): Duplicate Entry What??? Ah? Mysql> INSERT into UserInfo VALUES (' Tri Jianghu ', ' 20030481′, ' 2004b_8600661_03′, ', ', ', ' 2004b_8600661_03′);
ERROR 1062 (23000): Duplicate entry ' 20030481′for key 1
Mysql> INSERT into UserInfo VALUES (' Tang Bin ', ' 20023109′, ' 2004b_8600661_03′, ', ', ', ' 2004b_8600661_03′);
ERROR 1062 (23000): Duplicate entry ' 20023109′for key 1
Mysql>
Re:error 1062 (23000): What is the Duplicate entry??? Ah?
The second of your userinfo? Field requirements are unique, and your table has a. l??, and its second?? The value of field is 20023109
With the one you want to insert??? The second?? Field values are the same
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
All failed!
The Final Solution:
Usually because of the data table file damage caused by the use of the MySQL Repair tool myisamchk tool repair.
Cmd
Myisamchk Cdb_posts.myi-r
Fixing the datasheet is OK!
Solutions
Now attached to the solution as long as the original old data empty import on it.