Symptoms
When restoring a database, you may see an error stating there's a duplicate entry:
MySQL said:
#1062 - Duplicate entry 'number' for key 'PRIMARY'
Description
This error occurs either when inserting two rows with the same primary key, or when a table contains two duplicate rows. Here's an example:
INSERT INTO my_supercooltable VALUES ('number',10, 2, 'First',121,120,100);
INSERT INTO my_supercooltable VALUES ('number',10, 1, 'Second',98,61,100);
This error can also occur when a database dump does not drop existing tables.
Workaround
The user importing the database will need to attempt dumping the SQL file again or importing it to a fresh database. If that does not resolve the issue, a database administrator would need to review the SQL file to remove or correct duplicate entries.
For a list of System Administration Services, feel free to reference our public services list available here:
System Administration Services
Please note, however, that cPanel cannot be held liable for any services performed by third-party providers.
For more information, read more on primary keys in the MySQL documentation: