Duplicate entry ‘0’ for key 1

Making the server switch was an easy task. I uploaded my sql database in it’s new home and checked if things where fine. At first sight, it looked fine, but when I wanted to post something on my blog, I would get the Duplicate entry ‘0’ for key 1 error showing up. Did a little search on the subject to find out that my exported database didn’t contain the auto_increment ability in it… (I’m using wordpress 2.0.1 with phpmyadmin 2.6.2 (if I’m right)) So to make a long story short, here’s how I fixed it:
1. Go into your phpmyadmin panel. 2. For each tables structure, edit the first entry (which should be a primary key such as ID). 3. Delete the 0 in the default value and select “auto_increment” in the drop-down menu next to it (on the right). 4. Save. 5. Go to the next table and do the same.
After doing this, you should not face the problem anymore. Thanks to search engines for the answer 🙂
  • del.icio.us
  • Google Bookmarks
  • Reddit
  • StumbleUpon
  • Yahoo! Buzz

2 Responses to “Duplicate entry ‘0’ for key 1”


  • i already do what you said, but it still got this error 🙁
    I was upgrading from v2.2.2 to 2.6.
    Do u have any idea?

  • Look in the table for duplicates entries. If you’re specifying that one column should be unique, make sure every item in it are otherwise you’ll get a similar error.

Comments are currently closed.