Repair WordPress Database

When a WordPress table crash, one symptom might be that all of your posts seem to have disappeared, or perhaps all of your drafts. You may even get a message in phpMyAdmin telling you that one of your tables haves crashed. No need to worry. Repairing tables is very easy.

Warning : backup the WordPress database  before attempting to repair tables

1. phpMyAdmin

a. Login to phpMyAdmin and select the affected database
b. Check the boxes by the tables that need repair.

repair WordPress database with phpMyAdmin (click to see the screenshot)

2. WordPress built-in Repair Tool

Many users  are not aware about WordPress’s built-in database repair and optimize functionality, as it is not available in admin back-end. This feature available in WordPress 2.9 and later

Repair WordPress database with WP built-in repair tool (click to see the screenshot)

a. Simply add the following line in wp-config.php To setup the automatic database repair option,


b. Login to admin section of WordPress blog by visiting

c. Go to, you can see page with options to ‘Repair Database’ and to ‘Repair and Optimize Database’. Just click on one of the option.

  • If you click on ‘Repair Database’ button,  WordPress can automatically search for some common database problems and repair them.
  • If you click on ‘Repair and Optimize Database’ button, WordPress can also attempt to optimize the database. This improves performance in some situations. Repairing and optimizing the database can take a long time and the database will be locked while optimizing.

d. You can remove step (a) after you done.

WordPress Database Optimization

WordPress is powered by PHP and depends on MySQL database; in fact, all the content, including the website settings, are stored in it. When your WordPress site is visited, the web server will query the database to retrieve all the necessary information to display. However, over time, the speed required for querying the database will increase due to the number of operations such as insert, updates, and  delete of data entries.

From time to time it is a good idea to do a little housekeeping with your WordPress installation.  MySQL databases don’t clean themselves, it will help to free up disk space and keep your database running smoothly.

As a start, try optimizing the overheads on your database as reported in phpMyAdmin. When this occurs, you need to run Optimize Table manually via WP Optimize plugin or phpMyAdmin

Warning: backup the WordPress database before making major optimization efforts

1. WP Optimize Plugin

If you’re not familiar with phpMyAdmin, then a WordPress plugin may be a safer option for you.  Those plugins will allow you to select the tables you wish to optimize and will also show you the total size of your database and how much of it can be reduced after you have completed the optimization.

WP-Optimize: This is a database cleanup and optimization tool.It does all of this without the use of phpMyAdmin (a program used to handle the administration of your MySQL servers). It will show you which tables are already optimized and the ones that need to be optimized. Select the option:  Optimize database tables. Then click the Process button below the option

WP Optimize plugin (click to see the screenshot)

2. phpMyAdmin
If you have access to phpMyAdmin, simply login to your phpMyAdmin and select the option 1: Check tables having overhead . Then at the side in the drop down box, select 2: Optimize Table,  this will take care of all of your tables at once.

Optimize tables with phpMyAdmin (click to see the screenshot)

Moving WordPress blog from a subdomain to a subfolder

I had this blog and this main site on same domain, a year ago. I got high traffic to same domain.

I separated the blog from main site after serious problems occurred. I made for blog and for main site
That’s a mistake I should  not done.

Most startups have their blog on a separate sub domain like or blog.[your_domain].com
The thought of we could optimize it for SEO through the sub domain was wrong.
The traffic to the blog and the site lower than it was on same domain,

I decided to merge to, I’m moving the blog to or [your_domain].com/blog .
It’s a delicate process to move to My concern in traffic from Google, the old URLs redirect to the new site

1. Disable a Caching plugin installed on the site
Delete the cache and disable that plugin

2. Change WordPress address (URL) and Site address (URL)
I change  WordPress address (URL) and Site address (URL) from to This is a simply a matter of updating WordPress address and Blog address options from within the WordPress administration panel (Settings ->General)

3. Update Permalink structure.
Don’t forget to save Permalinks once more to make sure your WordPress site run smoothly. No need to change settings if you want to keep up same settings

3. Change Sub Domain root in cPanel
I created the blog subfolder in cPanel. The blog sub domain maps to a directory in the webroot called /blog/, however this directory been used by the new URL,
I change the document root so I can apply redirection. If someone visits a link to a page that includes the sub domain, the web server will tell the browser that new site.

4. Redirect old URLs to the new URL via .htaccess
Create new .htaccess on new Sub Ddomain root, add the following

<pre>Options +FollowSymlinks
RewriteEngine on
rewritecond %{http_host} ^ [nc]
rewriterule ^(.*)$$1 [r=301,nc]</pre>

If someone tries to visit,, the server will (301) redirect to

5. Remove the old blog subdomain from Google Webmaster Tools
6. Submit all sitemaps from new URL through [your_domain].com account to Google using Google Webmaster Tools.