importing table into database using phpmyadmin

broeder

Registered
Jul 14, 2012
1
0
1
cPanel Access Level
Website Owner
Hi,

I need to restore a table. So I log into cpanel/phpmyadmin, choose table T and hit "import". Then I
import the backup for table T.

I get this:
#1062 - Duplicate entry '1674' for key 1

I am wondering if phpmyadmin replaces table T with the backup or adds both (which creates duplicates).

Thing is when I import the whole backup database the same way, phpmyadmin dumps the old database
and replaces it with the backup. So what did I miss ?

Thanks if you can help..
 

cPanelTristan

Quality Assurance Analyst
Staff member
Oct 2, 2010
7,607
40
248
somewhere over the rainbow
cPanel Access Level
Root Administrator
MySQL itself tries to import entries without dropping the old data, which causes duplicates. This is why you'd need to import the table with the sql having had --add-drop-table flag for the creation. If it doesn't have that, it doesn't first drop the table to then import the new one.

You could always just drop the table before trying to add it to get around that. You have a backup, it appears, so hopefully dropping the table won't cause any issues.