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.

Favicon.ico, Logos, & Google

I took some of my own advice from ToDo List For New Web Sites and put together a favicon.ico file. If you are using Safari, you might have to clear your Icons folder, which is at Users/YourUserName/Library/Safari/Icons. Mozilla and Firefox should load the favicon fine, while IE won’t show it at all unless you have bookmarked WebKeyDesign.com.

While working on the favicon, I came up with a new logo too, but since 16×16 pixel limitations of the favicon would not show it very well, I decided to work on the logo later and see what else I can come up with later this weekend.

Some of you might have noticed that some pages have Google Ads and others do not. Essentially anything having to do with support of our customers is free of advertisements. Everything else, like the online tools we have made available, tips, and tutorials have some advertisements. About the most difficult thing I have found with the Google Ads is that they don’t fit into the standard template I have for the site, so I have had to go with smaller ads. Most WordPress sites that use the standard Kubrick template I would think would have some problems using the wider ads in general. Perhaps Google will offer different sizes in the future or will come up with something that can be more customized for the Kubrick template.

Speaking of Google, our site is still showing up with a pagerank of zero and it will not be changing any time soon. It seems Google does not give you a pagerank unless your domain has existed for more than a few months, something like 4-6 months is what the expected delay is. In the mean time WebKeyDesign will be growing.

Our next project in July will be a new forum. We have a test forum up, but I am not really happy with the forum software, so I am waiting on Invision to release their new version, this summer.

Taboo Safari Hack

Obsessive Compulsive Development has written a hack that they call Taboo. This hack enables warning dialog when you try to close out of Safari and there are multiple tabs open. This feature resembles the one in Firefox. Taboo’s other function is that you can disable the warning dialog that now appears when opening a download file automatically. Many users find this feature annoying in Mac OS X Tiger, even though it provides extra security.

For more Safari hacks and addons check out PimpMySafari.com who has the best catalog of Safari addons. There is now even adblocking similar to Firefox’s AdBlock extenstion!