ERROR 1062 (23000) at line [Line No]: Duplicate entry for key '[Key Name]'
Jul 2, 2013 · 1 minute readCategory: mysql
Importing a database dump from one location using mysqldump, and them importing it into a blank database I received this error:
ERROR 1062 (23000) at line [Line No]: Duplicate entry for key ‘[Key Name]’
The issue here is that a constraint is set up to prevent two rows containing the same value. Although key checks are disabled, it still can’t add the rows. Sometimes as a useful technique to just get it running locally (obviously there’s an issue here which does need resolving), simply change the “INSERT INTO” statement to “INSERT IGNORE INTO”, which will skip that entry.