Search

How to Repair a Crashed WordPress Table

Listen to this article

There are some articles you should definitely bookmark. Like this one. A guide to repair crashed WordPress tables. A crashed posts table can put you in a mode of panic. Imagine navigating to your admin dashboard, and finding your posts and pages count as zero. But don’t worry, all your data and hard work are still there in the database. You just need to repair the crashed table and everything will be back to normal.

 

Identifying a Crashed Table in the Database

If you go to phpmyadmin, and select your database, a crashed table will stand out from the others all will say “in use”. If you click on the table, an error message will be shown, notifying that the table “is marked as crashed and should be repaired”.

WP Posts Repair Table

To repair a crashed table, you need to select the table that has crashed, and then select the “Repair Table” option.

 

Allowing WordPress to Automatically Repair a Corrupted Database

If you do not want to meddle with the database yourself, there are several other ways to repair a crashed table. You can use the WP_ALLOW_REPAIR. In your wp-config.php, add the following:

[pre]define( ‘WP_ALLOW_REPAIR’, true );[/pre]

This will allow WordPress to automatically repair crashed tables, using a script found at {your-site}/wp-admin/maint/repair.php. Remember to disable this option in the config file, once the tables are fixed.

 

Using WP-CLI

If you use WP-CLI to manage your WordPress site, you can use the command, wp db repair to repair the database.

Don’t worry, any of these methods should work just fine, and your data should be back to it’s original state. Most importantly, you must remember to regularly take a backup of your database, which can save you a lot of trouble, in case something can’t be fixed or repaired.

 

Ankit Shah

Ankit Shah

Leave a Reply

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

Get The Latest Updates

Subscribe to our Newsletter

A key to unlock the world of open-source. We promise not to spam your inbox.

Suggested Reads

Join our 55,000+ Subscribers

    The Wisdm Digest delivers all the latest news, and resources from the world of open-source businesses to your inbox.

    Suggested Reads