WordPress database runs on the database management system, MySQL. Although rare, your Database has the chance of corrupting, which makes your website buggy or completely dysfunctional. We can help you fix such database errors.

Using WP_ALLOW_REPAIR

WordPress comes with a database repair feature that allows you to repair the corrupted database without in-depth technical knowledge.

Connect via FTP to your website and download the wp-config.php file. It is residing at the root folder of the WordPress installation.

Open the wp-config.php file with a text-editor and insert this line at the end of the file, just before the if ( !defined(‘ABSPATH’) ) line.:

define('WP_ALLOW_REPAIR', true);

Don’t edit or change any other stuff in the wp-config.php file unless you know what you are doing. Save the changes and upload this file back to your server. Make sure you overwrite the existing copy in the server.

In your browser, go to the URL http://yoursite.com/wp-admin/maint/repair.php. Don’t forget to replace “yoursite.com” with your own website’s URL. This is what you will see.

How to Repair WordPress Database

You can click either the “Repair Database” button or the “Repair and Optimize Database” button. Both will repair your database. We recommend to select the “Repair and Optimize Database” option since it optimizes your database as well.

You should now see a bunch of code. Scroll down to the end of the page and you should see “Repairs complete. Please remove the following line from wp-config.php to prevent this page from being used by unauthorized users.” That’s it. Your database is now repaired.

Reload your website to see if it is working and if you are able to login.

Lastly, remove the “WP_ALLOW_REPAIR” line from your “wp-config.php” file and re-upload it to your server.