WordPress by default uses a MySQL database to store much of the data. What happens if the database becomes damaged or corrupt in some way? Fortunately there is an inbuilt WordPress way of repairing and optimizing the database. Here is how to repair and/or optimize your WordPress Website MySQL database without having to access phpMyAdmin.
How to easily repair your WordPress database
Just follow the steps below:
- Save the following anywhere in your wp-config.php file (you’ll need access to your WordPress files via FTP or your Hosting control panel):
- Go to http://example.com/wp-admin/maint/repair.php (replace example.com with your domain name and you may need to also enter your WordPress directory e.g. http://example.com/wordpress/wp-admin/maint/repair.php).
- Follow the on-screen instructions to repair and/or optimize your database tables.
- Remove the line entered in step 1 above from your wp-config.php file.
This is a nice and simple means of optimizing and repairing your WordPress database. The same outcome may be achieved by running ‘Optimize Table‘ or ‘Repair Table‘ in phpMyAdmin or by using a Plugin such as WP-DBManager. Optimizing or repairing database tables only needs to be done very infrequently (or when you get a message in your WordPress dashboard advising that these are needed) so I’d recommend using the steps above rather than installing another Plugin.