Skip to content
repair a WordPress site's database featured

How to Repair a WordPress Site’s Database

A database is an important part of any WordPress site as it stores almost all its data and configuration settings. Therefore, when something happens to the database, it will immediately affect the site’s performance, causing anything from slow operation to complete inoperability. The main reasons why you would need to repair your WordPress site’s database are corrupted files or corrupted database tables. Database corruption is caused by any server-side problems, incorrect functioning of the theme or plugins or the site being hacked.

In this article we will review the methods you can use to repair your WordPress site’s database.

Preparation Stage

Before starting the process of database repair it’s good to create a full site backup. Actually, this step should be done every time you make any significant changes to your site such as installing/removing plugins, editing theme files or changing configurations. It allows you to rollback the site to the latest working state in case something goes wrong. You can use any third party backup plugin or backup tool in your hosting provider control panel.

WordPress Functions to Repair the Database

WordPress has its own functions that can help you to repair a database. At first glance, this may seem complicated but it is not. This approach requires access to your site via the FTP or File Manager tool in your hosting panel. In the WordPress installation folder find the wp-config.php file and open it to edit. In this file you need to add the following code before the line /* That’s all, stop editing! Happy publishing. */ :

define ('WP_ALLOW_REPAIR', true);

After saving the changes in the file, go to the browser and open the database repair page, which is available via the link (replace with your domain name). On the repair page you have two options:

  • Repair Database
  • Repair and Optimize Database

If you select the second option, after the repair process is finished, WordPress will attempt to optimize your database tables. Click the option you want and wait for WordPress to finish the process. Once it’s finished, remove the line that you added in the wp-config.php file.

Database Management Tool to Repair the Database

As a rule, there is a tool for working with databases in the hosting control panel. In most cases it’s phpMyAdmin, a free software tool intended to handle the administration of databases over the Web.

Once you are logged into phpMyAdmin, click on your database in the list of databases on the left side.

The tables of the selected database will display on the right side.

Scroll down the tables list, tick the Check all box and select the Repair Table option from the dropdown menu.

The system will go through your database tables and repair the corrupted ones.

Database Repair Plugins

In addition to the methods described above, database repair can be performed using third-party plugins such as WP-DBManager or Advanced Database Cleaner. Note that the plugin-based database recovery method can be applied only if you have access to your site’s admin panel. Both plugins we mentioned can be installed via the WP Dashboard > Plugins section.

repair WordPress site's database - wpDBmanager installation

Let’s check the WP-DBManager plugin, one of the simplest WordPress database plugins. It allows you to backup, restore,  repair and optimize databases; drop/empty tables; and run selected queries. To repair database tables you just need to open the Database > Repair DB section from the left-side menu, set “Yes” for the tables you want to repair and click the Repair button.

repair WordPress site's database - wpDBmanager

When the process is completed you’ll see the result at the top.

repair WordPress site's database - repair result


Without exaggeration, we can say that the database is the heart of the website and its correct functioning is extremely important. Having problems with connecting to your database or its incorrect functioning is a headache. However, knowing the methods we described in the article you can repair your WordPress site’s database with a few clicks. In case the WP Dashboard is working fine, you can use the plugin-based method. Otherwise, when the site’s admin panel is not working and you don’t have access to it, the WordPress repair function or the database management tool like phpMyAdmin can be helpful in repairing your WordPress site’s database.

Create Your
Dream Website with

Stay in the Loop

Sign up for our newsletter and stay up-to-date on the
latest WordPress trends, insights, and resources.

By entering your email, you agree to our Privacy policy and Terms of Services.


Alexander Hutsol

Alexander Hutsol

I started my online career as a support representative for a hosting company 10 years ago. Over time, I began to learn deeply how to create and support WordPress sites, and here I am, in the Artbees hive. In my free time I play drums, guitar and spend time with my lovely wife and kids.

1 Comment

  1. Due to the unfortunate abundance of potential causes, it can be challenging to identify the precise origin of any of these errors.

Add a Comment

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