How to Repair WordPress Database
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.
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.:
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.
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.
Using Your Control Panel
open your WordPress server's control panel from your hosting account.
You'll probably need to log in with the password and username you set when you created your hosting account.
Once you're logged in, you'll be presented with a panel that looks something like the screenshot below.
You need to find and click the phpMyAdmin button.
If your control panel looks different, don't be concerned.
Most hosting providers use cPanel, but if your host provides alternative management software, that won't be a problem. No matter what control panel you have, phpMyAdmin will probably be located under a 'Databases' header.
Now that you've entered the phpMyAdmin interface, select the correct WordPress database.
Your internal database folders will then appear in the sidebar. This will allow you to double check that you've selected the correct database: the folder names should all begin with 'wp_'.
Please Note: if you have multiple WordPress sites on your server, there'll be more than one WordPress database.
As the database naming system is random, you'll need to expand the 'wp_posts' table and check that the names of the posts match those of the corrupted site.
Select All of the Tables in Your Database for Repair
Once you've opened the correct WordPress database, you need to ensure that every part of it is repaired (unless your error message told you that only one part of your database was corrupted).
To do that, go to the bottom of the main directory window and select the 'Check all' box. This will highlight all the subdirectories within your WordPress database.
Once every subdirectory is selected, open the list next to the 'Check all' field and select 'Repair table'.
Congratulations, you've now managed to start the repair WordPress database process!
But you need to check that the repair worked.
You'll now be taken to the repair results screen. The messages displayed here will tell you if the repair was successful. Along the top, you should see the following message:
My name is Linda, I have Master degree in Information Technology Engineering. I have some experiences in working with Windows and Linux VPS and I have been working for 2 years on Virtualization and Hosting.