Mysqldump Lead Library error Duplicate entry "for key 1

Source: Internet
Author: User


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.

Contact Us

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: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.