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?
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.
Your edit is attempting to re-CREATE the user, instead of UPDATE-ing the existing user. It's a bug with the plugin. You may want to report it to the author or wait for an update to come out.
If you are trying to import SQL file , make sure that you “Disable foreign key checks” . For that just add SET FOREIGN_KEY_CHECKS = 0; at the start of SQL file. Also add SET FOREIGN_KEY_CHECKS = 1; at the end of file.
精彩评论