phpmyadmin error "#1062 - Duplicate entry '1' for key 1"

Jitendra Vyas picture Jitendra Vyas · Jul 19, 2010 · Viewed 55.1k times · Source

I dropped all tables from a database then restore(import) a backup. Afterwards I am getting error #1062 - Duplicate entry '1' for key 1.

Should i repeat the process. Or something else? Why this error is coming?

Answer

Gary Tsui picture Gary Tsui · Aug 28, 2013

When you export your sql from php admin

enter image description here

Select "custom" as export method"

enter image description here

then, instead of 'insert', choose "update"

This will perform update-statements and prevent duplicated inserts.