mysqlsqlmagentomysql-error-1062

Magento -- "SQLSTATE[23000]: Integrity constraint violation.." on customer update


After migrating servers, I'm getting an error every time I try to update customer information. I'm using a customer activation plugin, but after disabling it, I still get the same error.

SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '7-127' for key 2

What is wrong?

Even after uninstalling the plugin, I get this error while trying to save customer information. So this leads me to believe its a bigger problem with Magento and/or the server I'm switched to.

I checked the Magento's log and I'm getting this Notice multiple times:

ERR (3): User Notice: Sorry, your PCRE extension does not support UTF8 which is needed for the I18N core  in ../httpdocs/store/lib/Zend/Locale/Format.php on line 769

Is this relevant?


Solution

  • The issue is because when you migrated your database, mysql helpfully restarts the id columns that are auto-increment and Magento has some hardcoded values that assume that IDs start from zero. You need to disable foreign_key_checks when you import the data.