Optimize Your MySQL Databases

Many popular PHP applications like WordPress and Textpattern, along with forum software like Invision Powerboard use MySQL databases to store their data and over time these databases require some maintenance. For example if you have deleted a lot of posts from your blog or forum recently, you might consider optimizing your database tables to improve performance.

This tutorial explains how you can run the Optimize Table command in cPanel.

Warning!!! Before you attempt to do this tutorial on your own data, you should backup your MySQL databases either from within cPanel or through your own program, if it has a backup database function. You should not attempt to do this procedure if your software has its own database maintenance functions, like Invision Powerboard which has its own database options in the Administrator panel. Proceed at your own risk!

First log into cPanel and open up the MySQL Databases manager icon. At the bottom of this screen you will find a link for phpMyAdmin. Clicking on this link will open up a new browser window with the home screen for phpMyAdmin.

On this screen, click Databases. This will list all the databases you have setup. Click on the database you want to work on. The database screen will list the tables for the given database.

phpMyAdmin Database Tables

Click the Check All link on the bottom left. Then from the pulldown menu choose Optimize Table.

PhpMyAdmin will give you some information once the operation is done. Close the window and then logout of cPanel on the original browser window. Close out of your browser completely to end the session.

If you are wondering what the Optimize Table command actually does, according to the MySQL Manual it basically defragments your database:

OPTIMIZE TABLE should be used if you have deleted a large part of a table or if you have made many changes to a table with variable-length rows (tables that have VARCHAR, BLOB, or TEXT columns). Deleted records are maintained in a linked list and subsequent INSERT operations reuse old record positions. You can use OPTIMIZE TABLE to reclaim the unused space and to defragment the data file.

In most setups, you need not run OPTIMIZE TABLE at all. Even if you do a lot of updates to variable-length rows, it’s not likely that you need to do this more than once a week or month and only on certain tables.

Note that it is possible to run phpAdmin without going into cPanel, but for the sake of simplicity, this is the easiest way for most cPanel users to find phpMyAdmin.

For more information:

phpMyAdmin: This is the homepage for phpMyAdmin.

WordPress Optimize Your Database: an interesting post describing why you should optimize your WP database.

cPanel User Guides & Help: more links for learning cPanel.

What is PageRank?

PageRank is something which the search engine Google has made very popular. It is a number score that Google gives to each web site on the internet. This is also the reason why many sites are spammed with links to other sites to increase those sites’ PageRank score. It is why you sometimes get emails from people you don’t know offering to help optimize your site.

Google constantly refines their ranking system and the parameters that determine page rank have never been publicly available.

If you would like to increase your site’s page rank, the first thing to do is go to Google’s Add Url site. Here you can submit your web site to Google.

Yahoo also has their own submission form.

If you are using a blogging system like WordPress, you should research how the system outputs meta descriptions for your pages. For WordPress, adding something like this to the Header Template’s should help:

<meta name="description" content="SiteName is a site for talking about widgets.">

Having a simple and user-friendly permalink structure in WordPress is also important.

For more information on search engine optimization see SearchEngineWorld.com, and make sure you read their Guide which is helpful when starting a new site.

WordPress Quicktags Buttons Broken

If all of a sudden your Quicktags buttons no longer insert tags in your WordPress Write section, then the problem could be related to one or more WordPress plugins that you have installed.

I started having problems with the more button, as well as a couple of other quicktags that my other plugins added.

I traced the problem down to the Contact Form plugin, which has an option to enable it’s own quicktag button. If I disable just the quicktag and not the plugin, all my other quicktag buttons now work, including the ones that my other plugins added!

If you are having a similar issue with WordPress, try disabling one plugin at a time to see which one is causing it.