Wordpress – tech-junky.com http://tech-junky.com Just another WordPress site Tue, 04 Jun 2019 15:03:00 +0000 en-US hourly 1 https://wordpress.org/?v=6.5.2 Repair and Optimize your WordPress database http://tech-junky.com/blogging/repair-and-optimize-wordpress-database/?utm_source=rss&utm_medium=rss&utm_campaign=repair-and-optimize-wordpress-database Mon, 09 Jul 2012 15:03:00 +0000 http://tech-junky.com/blogging/repair-and-optimize-wordpress-database/ Continue reading Repair and Optimize your WordPress database]]>

If you’ve been running a WordPress blog for quite some time, chances are you that might have database problems. The use of a lot of plugins and import-exports can cause errors to creep into your database. It’s a good habit to check for errors and repair and optimize your database once in a while. With WordPress 2.9, an option to repair and optimize WordPress database was introduced within the system. By default the option is disabled but the addition of a simple piece of code to the wp-config.php file is all that is needed to enable it.

Follow the steps below to repair and optimize your WordPress database:

1. Login to your cPanel and open up the file manager.  Alternatively you can use an FTP client for the same.

2. In the root directory (public HTML) there’s a file named wp-config.php. While editing this file take utmost care. You should back it up first. Open up this file and add the following code to it:

define(‘WP_ALLOW_REPAIR’, true);

Once done. Save the file.


3. What you just did was enable the automatic repair and optimize database option. But how do you access it?  Visit the following page: http://yourwebsite.com/wp-admin/maint/repair.php

4. On opening that page you’ll see something like the image above. Now it gives you two options – Repair database and Repair and Optimize database. The first one will look for common database errors and fix them. The second option will also improve performance by optimizing the database. Choose whichever you want to.

Alternatively you can also view the MySQL tables which have errors by clicking the Repair database option and then fix them with the help of phpMyAdmin. This involves opening phpMyAdmin from your cPanel and going to Databases > Your Table and selecting the tables with problems and then selecting repair from the drop down box.

5. Once you’re done repairing the WordPress database, make sure you remove the define(‘WP_ALLOW_REPAIR’, true); line you added to wp-config.php so as to prevent it from being used by unauthorized users. You can always add it back whenever you wish to check for errors.

Keeping a check on the health of your WordPress database is a good habit and should be practiced every once in a while. You should check for database problems and repair them on a timely basis. Also optimizing your database can help improve performance.

You may also like:

]]>
299