WordPress Database Error: Duplicate entry `0` for key 1
Posted on July 13, 2010. Updated July 13, 2010.
Summary
Losing auto-increment attributes will lead to unintended consequences in your Wordpress installation.
After migrating a large WordPress Mu database to a new host, I encountered errors when attempting to create new blogs. This awesome developer posted a solution a few years back, noting auto-increment attributes sometimes get lost when doing MySQL dumps.
To prevent this issue from happening, be sure to use --complete-insert when running mysqldump. The addition of --create-options couldn't hurt.
Here's a quick example:
mysqldump --quote-names --complete-insert --create-options
--user=username --password=password database > dumpfile.sqlThis is one of those errors that doesn't make any sense at all, until it sinks in. After awhile, it makes total sense.
This entry was posted on Tuesday, July 13th, 2010 at 3:17 pm and is filed under Developer Notes. You can follow any responses to this entry through the RSS 2.0 feed.You can skip to the end and leave a response. Pinging is currently not allowed.
sandy said:
August 3rd, 2010 at 9:57 am
Uzno3n http://fgb7s3Ffjsev7yrbvqqcf7.com
ZigPress said:
August 11th, 2010 at 9:41 am
Fantastic life-saving tip - many thanks for posting. I thought I was going mad when a restored WordPress installation wouldn't save any new data! Then I saw the lack of auto-increment on the restored tables, and your post told me why it had happened.