WordPress Back To Default Install State – wp_options Table Corrupted

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.

Wordpress Install

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.

Repair Database

After the database is successfully repaired you should see something like this:

Repaired Database

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.

Wordpress Clean Options Plugin

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.

Comments

comments

Subscribe

You can subscribe via e-mail to get my posts in your Inbox, or stalk me on numerous other platforms.

, , , , , , , , , , , , , , , , ,


15 Responses to WordPress Back To Default Install State – wp_options Table Corrupted

  1. Chriso June 18, 2009 at 12:54 pm #

    awesome plugin. on an unrelated note i wish there were revision management for themeing, i just lost my style.css which contains a lot of revision from the original, and here i am staring at my screen wondering what to do…

  2. Michael Yip June 18, 2009 at 1:16 pm #

    thanks for the heads-up regarding this issue.

  3. KY June 18, 2009 at 1:40 pm #

    oOo, and Wp 2.8 is out!

  4. ShaolinTiger June 18, 2009 at 5:39 pm #

    Chriso: Haha, that one is your file management leh, I never overwrite the original file when editing. And you must have one copy either on the server or on your PC.

    Michael Yip: No worries, hope you don’t encounter it 🙂

    KY: Yah, no major changes loh.

  5. Chriso June 19, 2009 at 9:58 am #

    situation solved. Mr Lee from IpServerOne contacted me back within 15 minutes while the staff there replied my e-mail (and this was during lunch hour) and they took me on a de-panicking ride, and within 30 minutes they got me back a copy of the file dated the night before with no charges, hassle-free.

    Amazing host, superb support, which is why I’ll be bringing my business to them! 😀

    (and this is all thanks to u for introducing him :P)

  6. ShaolinTiger June 19, 2009 at 3:10 pm #

    Chriso: And that’s why I ALWAYS recommend IPServerOne, their support is insane.

  7. Teddy June 23, 2009 at 2:53 pm #

    Hmmmm, regarding that issue, have you tried optimizing the table? It might help, but yeap, a thorough fix will be using the plugin. But do proceed with caution. I’m glad that it fixed the problem for you.

    My initial diagnosis will be a disconnected database – there were a few instances in the past when the database got disconnected and my WP blog greets everyone happily with an installation page.

    p/s: Glad that Chris found his style.css! It was a harrowing experience indeed.

  8. ShaolinTiger June 29, 2009 at 5:34 pm #

    Teddy: Yah I did, I did both – clear out and optimize. It hasn’t corrupted again since then so I hope it should be ok.

  9. Mark September 25, 2010 at 10:02 pm #

    This post is muhc appreciated mate. I started getting the install page the other day and assumed it was either a WordPress bug or a database error.

    When it happened again today I knew something was up with it, so your post was very helpful. So far I’ve removed around 300 entries, so I’m down to around 500 at the moment.

  10. ShaolinTiger September 29, 2010 at 5:06 pm #

    Mark: Glad I could help 🙂

  11. Jason November 20, 2010 at 1:02 pm #

    OMG its been hours my site has disappeared used clean options before reading this and deleted the lot. Went to test and site did not load, wordpress CP will not load FTP, unable to connect…..
    Thought I’d check with host just in case and they have server problems so now on 9th hour of sitting here reloading pages and I still dont know if I messed up big time or its just host server issues!!!!!!

    Massive stress all the work and I still dont know if its all lost!!!!!

    So clean options looks fab as I could not believe how much junk was just sitting there from messing about with plugins and themes but I will re iterate please please please make sure you know what your removing.

    I didnt I dont and I still dont know if I have a site anymore!!!!!

    Oh and whilst I shouldnt mention them by name but choose your host wisely mine is Naff!!!!! 9hours at least so far so imagine if my site was making money

    will get back & let you know if its dead or alive!!!!!

    Jason

  12. Jason November 23, 2010 at 9:34 am #

    Ok so basically if anyone is interested here is the final outcome!

    I was a bit delete happy as I thought but things didnt turn out as bad as expected, In the end my hosts servers where down from Fri afternoon to Mon afternoon that was one stressful weekend.

    Anyway seems of the problems I have had so far as a result of deleting too much with clean options the nav menu is a bit messed up and some of the remodeling of my theme had disappeared. There was one problem I was flumexed over the featured image section in my wordpress control panel had disappeared. So could’nt find any help but had a Eureka moment on my own!

    Force wordpress to reinstall latest version surely that would add some missing items to my table.

    Wow it worked, just gotta sort that nav menu now on mysite and all is well in the world.

    So in summary, back up 1st, then be sure you delete only what you know, and maybe if you accidentally delete too much reinstall latest wordpress in background from dashboard. worked for me. cheers

  13. ShaolinTiger November 25, 2010 at 4:21 pm #

    Jason: Good to see your site back up, but yah please be VERY careful when using clean options. A lot of new themes use the wp_options table to store theme config options, so only delete what you are really sure is redundant.

  14. Steven April 20, 2011 at 5:47 pm #

    I thought I was hacked till I read this.

  15. memo May 8, 2012 at 2:09 pm #

    Thanks, you saved my life, and my site.

 
Keep up with me on Social Media by following me below - Thanks so much!