Jeevan Dongre
Jeevan Dongre

Reputation: 4649

Duplicate entry '1' for key 'PRIMARY'

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?

Upvotes: 0

Views: 5251

Answers (1)

Marco
Marco

Reputation: 57573

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.. ?

Upvotes: 1

Related Questions