Manually Repairing Crashed Tables for WordPress

Any number of server issues can cause your MySQL tables to crash, requiring your instance of WordPress to be repaired.  You may see this issue emerge in the form of the error message, “wp_options table marked as crashed”, though it can occur with any table and not just wp_options.

At this point, WordPress will try and walk you through the use of its own database repair tool, which requires first adding this line to your wpconfig.php file.

define('WP_ALLOW_REPAIR', true);

This will allow the tool to run and you should be able to repair your database with no trouble.  However, you may see the “Failed to repair the wp_options table. Error: Table is marked as crashed” message.  What happens when the WordPress repair tool is unable to fix the crashed database table?  If you have phpMyAdmin on your database server (you likely do), you can repair the table manually.

Log in to phpMyAdmin and select the table you need to repair from the left hand navigation.  On the following details page for that table, if you scroll down to the bottom of the page, you will see a section titled “Table Maintenance”.

The Repair Table Link in phpMyAdmin

The Repair Table Link in phpMyAdmin

From the “Table Maintenance” section, click the “Repair table” link.  You should see a message that the table was repaired successfully.  You will need to do this individually for any tables that the WordPress repair tool reports that it is unable to repair.  Once this task is complete, you will be able to access your WordPress instance again.

Thanks for reading!  Feel free to leave a question or a comment.