mysql duplicate entry error 1062 when restoring backup
5
votes
4
answers
24523
views
Sorry, I seen similar threads but I still couldn't find it addressing my issue plus, I needed some more info on this.
**Requirement:** To create an exact replica 'db4' of an existing DB 'db3'.
**Procedure followed:**
* mysqldump -uuser -ppass db3 > db3.sql (size is 6G)
* mysql -uuser -ppass db4 < db3.sql (db4 was a newly created blank database)
The 2nd step throws in the error:
ERROR 1062 (23000) at line 5524: Duplicate entry '600806' for key 1"
I ran the 2nd step again with --force. The restore completed but with 2 additional similar errors:
ERROR 1062 (23000) at line 6309: Duplicate entry '187694' for key 1
ERROR 1062 (23000) at line 6572: Duplicate entry '1567400' for key 1
On completion when I queried certain tables of db4 database, I was able to see missing records.
**Question:**
1. Does this indicate a corrupted/problematic db3 database?
2. How to proceed to create a 'consistent/working' replica (db4) of db3?
3. If (2) fails, how to possibly troubleshoot and find the reason behind why it occurs?
Thanks,
Asked by user492160
(51 rep)
Jan 8, 2013, 11:52 AM
Last activity: Aug 7, 2020, 03:16 PM
Last activity: Aug 7, 2020, 03:16 PM