How to Optimize and repair WordPress Database without using Plugins

As a webmaster we need to optimize WordPress Database tables periodically (and repair if necessary) for achieving optimum website performance.Optimizing the WordPress database at regular intervals will load your blog faster and removes the cache created.

Most of the webmasters use plugin’s to optimize database but in this article I offer you a step-by-step guide to optimize database without using a WordPress plugin because WordPress has a built-in Repair and Optimize functionality by default which can be run from the admin back-end.

If you want to perform database optimization using plugins you can see this article WordPress Plugins required to optimize WordPress database.

Optimize & Repair Database Using Default WordPress Functions?

This can be done by navigating to http://www.youwebsitename.com/wp-admin/maint/repair.php.

Note : Replace Yourwebsitename in the Above url with your Website Name.

By default when you try to access the above mentioned url you only see instructions and you don’t have any buttons to optimize or repair the WordPress database.

How to optimize WordPress database with default wp-config option

Default /wp-admin/maint/repair.php

To activate the buttons in the file you need to add the proceeding code without Double quotes ” add define(‘WP_ALLOW_REPAIR’, true);” at the end of wp-config.php and save the file.The wp-config.php file is located in your Top directory of wordpress installation

Step1: Login to your WordPress admin

Step2: Open http://www.yourwebsitename.com/wp-admin/maint/repair.php and Now you can see a page with two options first one is “Repair Database” and second one is “Repair and Optimize Database”. Click on any of the option.

If you click on “Repair Database” option, WordPress will automatically look for some common database problems and repair them automatically by executing SQL queries in WordPress database tables.

If you click on “Repair and Optimize Database” option, WordPress also attempt to optimize the database. this improves the performance in some situations.

Caution: Repairing and Optimizing database option can take long time and database can be locked while optimizing.

Note: Please take a backup of your WordPress Database before performing any action on the database.