I've noticed that in my development instance of Wordpress that wp_options contains duplicate rows. After some more investigation I found that the primary_key and auto_increment restraints were removed from the option_id column.

Does anyone know how this could have happened? I certainly didn't go in and remove these myself. Some ideas:

  • Bad database import
  • Plugin modified the database
  • Wordpress update failed

I found this wp.stackexchange question which describes the same problem, but the answers don't seem to explain how it could have happened in the first place.

Thank you for your assistance brainstorming what would have triggered this problem. I'd like to prevent it from occurring in the future.

2 Answers 2


Well after a lot of digging, I think I uncovered what happened. The clue came from the fact that I noticed it was wp_options and all alphabetically subsequent tables that lost their primary keys.

On import, first the tables are created. Next it goes through all those tables in alphabetical order and applies the primary keys and auto_increment flags. It would seem the application of keys and flags was interrupted just prior to wp_options and the failure cascaded down.


Only use WordPress Plugins when these rules are met:

  • WP Plugins come from the Wordpress plugin library. https://wordpress.org/plugins/
  • WP plugins have been approved by WordPress.
  • WP plugins are up-to-date.
  • You are the author of a WP Plugin and support it.

When you don't follow these rules, that leaves your website open for problems and malware attack.

  • I would assume plugins do not have modification permissions on the database, simply read/write via Wordpress methods. Are you suggesting the development platform was hacked by malware? Seems unlikely given my development environment is behind a firewall.
    – mrtsherman
    Commented Aug 11, 2016 at 19:07
  • I'm simply stating the most common problem. What firewall do you employ? Commented Aug 11, 2016 at 20:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.