Unable to edit wp_options in phpMyAdmin

This fix is for issues where you’re unable to make changes to specific tables of your WordPress database (the same logic can be applied to other scripts as well).

Basically, you do not see the following options while viewing your database tables through phpMyAdmin:

This issue occurs due to missing PRIMARY and UNIQUE key’s in the database tables. If you have access to phpMyAdmin, fixing this issue is fairly simple.

Before we start, we’ll take a backup of the database, just to be on the safer side. You can refer this article to know more abut exporting your database through phpMyAdmin.

Now that we have a backup of the existing database, We’ll proceed with repairing our WordPress database. Please follow these steps:

  • Access the database table that you’re unable to edit, and click on Structure. We’ll consider wp_options table with issue for now
  • wp_options table has a PRIMARY key and one UNIQUE key
    PRIMARY key : option_id
    UNIQUE key : option_name

    We’ll need to make sure we assign both the keys respectively.

  • Click the checkbox next to option_id and then click on Primary. Similarly, click the checkbox next to option_name and then click on Unique.
  • This will setup the PRIMARY and UNIQUE keys for the database table and get you access to the database edit options

You can also run this SQL query if you’re having trouble updating the options in the steps mentioned above.

  • Access the wordpress database and click on SQL.
  • Enter the following SQL commands, one at a time and hit the ‘Go’ button.
    ALTER TABLE `wp_options` ADD PRIMARY KEY(`option_id`);
    ALTER TABLE `wp_options` ADD UNIQUE( `option_name`);
  • You shuld now have access to edit the database tabled through phpMyAdmin.

This Official documentation by WordPress.org has information on the database structure, KEY structure for each table and much more: Database Description

/ /

Report (Please include link to post while reporting)

Leave a Reply

Your email address will not be published. Required fields are marked *