lior r lior r - 22 days ago 7
MySQL Question

magento SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '363624' for key 'PRIMARY'

i have migrated a mgento installation doing the following:


  1. copied all files

  2. exported the db

  3. imported the db using mysql workbench

  4. changed the base_url's to the new domain

  5. updated local.xml to the correct settings



now im getting:

SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '363624' for key 'PRIMARY'


I have searched the db for this key 363624 , but it is not duplicated as the messages says

how can i solve this ?

Answer

It is not duplicated but rather something must be trying to duplicate it.

How did you export the database? I would check that the dumped SQL file has the line "SET FOREIGN_KEY_CHECKS=0;" or similar at the top.

If not, I would drop the database and add this line to the top of the file:

SET FOREIGN_KEY_CHECKS=0;

... and this line to the bottom:

SET FOREIGN_KEY_CHECKS=1;

... then try again.

Comments