I just did a sql dump using a python script and compressed it. When I tried to restore the same in my local machine I am getting an error “Duplicate entry ‘1’ for key ‘PRIMARY'”. But I have created a separate test database, which is empty.
Whats the problem and what would be the solution?
I suppose your dump contains database name inside (something like
USE your_database), so when you try to restore it you get that error.Another condition could be a wrong dump: did you check your dump does not contain really duplicate keys?
And more: do your dump have
DROP TABLE ... IF EXISTS..?