Topic: "Duplicate entry '2' for key 1" when importing a sql file

I'm trying to import a .sql to an existing db. The first attempt threw this;

ERROR 1062 (23000) at line 66758: Duplicate entry '20080622195833' for key 1

...but subsequent attempts are throwing;

ERROR 1062 (23000) at line 63: Duplicate entry '2' for key 1

Are there some steps I can take to work round this? The .sql file is 133mb, which means editing it in textmate makes my mac crash, and I can't try the import in development because I don't have access to 'mysql' on the command line (the paths are all funny and no amount of re-configuration attempts have fixed it) and phpMyAdmin has a 5mb upload limit. 

I've tried using the rake db:schema:load and rake db:reset to clear the DB after attempting the import; am I right in assuming that these would empty the DB of records and, in theory, the first duplicate entry would be set back to 20080622195833?

Any help is much appreciated, I've been stuck on this for ages.

Re: "Duplicate entry '2' for key 1" when importing a sql file

Fixed it. The schema had already been loaded using rake db:schema:load, and layering the .sql file on top wasn't working even - potentially due to an auto-incrementing column - even though there were no records in the tables.

I dropped the DB (luckily I was in a position to do so), created a new db, and imported the .sql in to the empty db (after testing the process in my dev environment).

Re: "Duplicate entry '2' for key 1" when importing a sql file

Propably a table field has  unique attribute , remove this attribute or don't let the script die when an error occurs.

Re: "Duplicate entry '2' for key 1" when importing a sql file

What attribute should I used when I encounter error like duplicate entry...

Re: "Duplicate entry '2' for key 1" when importing a sql file

That's a pretty broad question. Can you give an example that is more specific?