If you read my blog every day or so you may have noticed a couple of times in the past week or so it just showed the default WordPress installation screen.
Some people seem to think they’ve been hacked when they see this screen as it indicates the database is totally gone. The most common cause for this however is that the WordPress table wp_options has crashed or become corrupted and needs repairing.
If you have logging and access to the server you should see something like this:
./loginname_blog/wp_options' is marked as crashed and should be repaired
I have a simple control panel for my blog (DirectAdmin), most hosting will offer you something like this or something more complex like CPanel. You can find out what is corrupted by pressing the ‘Check’ button, if you just wish to go ahead and fix the problem use the ‘Repair’ option.
After the database is successfully repaired you should see something like this:
A similar operation can be done with MySQL via command line or via PHPMyAdmin quite easily.
Now this is all well and good, but it doesn’t fix the source of the problem. You can’t keep repairing every time your database crashes, it started happening to me almost daily.
From my research, it seems that having too many records in the wp_options table can cause things to get funky and make it likely to become corrupted. Mine had a staggering 6234 records, a ‘normal’ wp_options table should have about 500 maximum.
Now what I didn’t realise that was every time I installed or tested a new plugin, it left a bunch of records in the wp_options table and when I removed it…it didn’t remove the records.
So I had all kinds of junk in there from the past 4 years of upgrades and experiments plus a whole lot of RSS hashes (which you can get rid of too).
My recommended solution is to use Clean Options, which is a plugin for WordPress that allows you to clean up your wp_options file.
Just PLEASE PLEASE do some research and use it very carefully because it can destroy your install, I recommend that you backup your database before you start fiddling even if you’re very sure what you’re doing.
Before you delete anything do use the Google option and check out what created it, remember if you’re using WordPress 2.8 there are transient entries that are not orphaned they are part of the new WordPress DB structure.
If you find anything from a plugin you no longer use you can safely delete it, you can ditch all the RSS hash entries. You have a far cleaner wp_options table after that!
I managed to take mine down to 234 rows, it’s back up now due to the rss_hash entries but other than that it’s pretty clean and slick and hasn’t crashed since I’ve done the tidy up.