Knowledgebase
How to enable and use the automatic database optimization and repair tool in WordPress
Your WordPress installation comes with a script that can be used to repair and optimize the database in which the application is installed. This is performed by executing a file called repair.php. The file can be executed by opening its URL address with your web browser. However, before that you have to add a line of code to the wp-config.php file of your WordPress installation.
The wp-config.php file is located in the root WordPress folder on your hosting account. So if the application is installed directly in the public_html folder on your WordPress hosting account, the path to the file will be public_html/wp-config.php. Edit the file and on a new line add the following code:
define('WP_ALLOW_REPAIR', true);
You can do that from the Files section of the Pixie control panel. Alternatively, you can download the file on your local computer with an FTP client, edit it with a text editor (e.g. Notepad, Wordpad) and upload it back replacing the old file.
Then you need to open the URL address corresponding to the location of the repair.php file on your hosting account. So, if the homepage of your site is yourdomain.com, then with your web browser open yourdomain.com/wp-admin/maint/repair.php. On the page that opens there are two buttons: Repair Database and Repair and Optimize Database. So depending on whether you want just to repair the database or to repair and optimize it at the same time, click on one of the two buttons.
Note that when the above mentioned code is added to the wp-config.php file, any visitor on your site can open the URL address of the repair.php file and run the optimization and repair function. So it's recommended to remove the code from the wp-config.php file once you're done. In this way you'll disable the function.
Of course, you can also use phpMyAdmin to repair and optimize any of your databases. For more information check out the tutorial on repairing and optimizing MySQL databases using phpMyAdmin.