Technology WordPress Tips & Tricks

How to Repair a Crashed WordPress Table

A crashed database table can take your site down or scramble its content. Here is how to repair a crashed WordPress table, so you can recover quickly and get your site back to working order.

Ankit Shah Ankit Shah 2 min read
How to Repair a Crashed WordPress Table

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.

 

Get a FREE Consultation

Let's build something that lasts.

Share what's on your mind — a clear brief, a half-formed idea, or just a sense that something needs to change. We'll listen first, ask the right questions, and point you toward what's actually worth building.

We take on a handful of projects each quarter,ones where we can truly make a difference.

  • Receive a human response within 24 hours
  • Get a detailed scope and quote upfront
  • We're happy to sign an NDA upon request

    Free 30-Min Strategy Call

    Your Name *

    Your Phone No *

    Work Email *

    Your Budget*

    Project Details *