> ## Documentation Index
> Fetch the complete documentation index at: https://kb.hosting.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Fixing database table problems in WordPress

> Learn how to enable WordPress table fix option to repair WordPress database issues.

When there is a problem with the database, [WordPress](https://hosting.com/hosting/platforms/wordpress-hosting/managed-wordpress-hosting/) shows a database connection error. Usually, the error appears when the WordPress database connection configuration is not correct, database server issue, or the database is corrupted.![](https://static.hosting.com/kb/kb_wp_wordpressdatabase_connectionerror.png)

However, if the database server is working correctly and the connection configuration did not change, this could mean that the database is corrupted and it needs to be repaired.WordPress comes with a tool to fix a damaged [WordPress](https://hosting.com/hosting/platforms/wordpress-hosting/managed-wordpress-hosting/) tables.This article describes how to repair a WordPress database.

## Fixing WordPress database problems

To repair database issues in WordPress, follow these steps:

1. Log in to **cPanel**.
   > 📘 Note
   >
   > If you do not know how to log in to your cPanel account, please see this\
   > [article](/docs/accessing-cpanel).

2. In the **FILES** section of the **cPanel** home screen, click **File Manager**:\
   ![](https://static.hosting.com/kb/kb_wp_wpdatabaserepair_filemanager.png)

3. In the left sidebar, click the name of the directory where you have installed WordPress, and locate the **wp-config.php** file:\
   ![](https://static.hosting.com/kb/kb_wp_wpconfigfile.png)

4. Open the **wp-config** file in a code editor

5. Scroll down to the end of the file, and add the following line to enable the **Repair Database Feature**:

````
define('WP_ALLOW_REPAIR', true);
```![](https://static.hosting.com/kb/kb_wp_wpdatabaserepair_configscript.png)

6. Save and close the **wp-config.php** file. 

7. Open your web browser, and type the following address to load the **WordPress Database tool**:

REPLACE-WITH-YOUR-SITE-URL/wp-admin/maint/repair.php![](https://static.hosting.com/kb/kb_wp_wpdatabaserepair_url.png)

8. Click on **Repair Database**:
![](https://static.hosting.com/kb/kb_wp_wpdatabaserepair_repairdatabase_button.png)

9. Wait for the process to finish. Once it is done, a report page will be displayed listing any issues with the WordPress database:
![](https://static.hosting.com/kb/kb_wpdatabaserepair_logreport.png)

10. Finally, remove the line added in step 6 from the wp-config.php file and save the file to disable the repair option. 

## More information

For more information about database management, please visit: [https://www.hosting.com/blog/what-databases-are/](https://www.hosting.com/blog/what-databases-are/) 

## Related articles

- [Cleaning a WordPress database with the Advanced Database Cleaner plugin](/docs/cleaning-a-wordpress-database-with-advanced-database-cleaner-plugin)

 
````
