Repair WordPress Database

When a WordPress table crash, one symptom might be that all of your posts seem to have disappeared, or perhaps all of your drafts. You may even get a message in phpMyAdmin telling you that one of your tables haves crashed. No need to worry. Repairing tables is very easy.

Warning : backup the WordPress database  before attempting to repair tables

1. phpMyAdmin

a. Login to phpMyAdmin and select the affected database
b. Check the boxes by the tables that need repair.

repair WordPress database with phpMyAdmin (click to see the screenshot)

2. WordPress built-in Repair Tool

Many users  are not aware about WordPress’s built-in database repair and optimize functionality, as it is not available in admin back-end. This feature available in WordPress 2.9 and later

Repair WordPress database with WP built-in repair tool (click to see the screenshot)

a. Simply add the following line in wp-config.php To setup the automatic database repair option,


b. Login to admin section of WordPress blog by visiting

c. Go to, you can see page with options to ‘Repair Database’ and to ‘Repair and Optimize Database’. Just click on one of the option.

  • If you click on ‘Repair Database’ button,  WordPress can automatically search for some common database problems and repair them.
  • If you click on ‘Repair and Optimize Database’ button, WordPress can also attempt to optimize the database. This improves performance in some situations. Repairing and optimizing the database can take a long time and the database will be locked while optimizing.

d. You can remove step (a) after you done.