solostream

Crash! Burn! How to repair tables in the WordPress database

Rebecca Markowitz | September 23, 2008 | 10 Comments

We just got a scary phone call. Don’t worry, everyone’s ok. We logged into one of our WordPress sites and, while the backend was still there, all the posts and pages and comments were gone. G-O-N-E.  Poof. Just like that. I went into the PHPmyadmin section of the control panel to look at the database and saw this error: “wp_posts” is marked as crashed and should be repaired.

After a mild heart spasm, I started searching the web furiously for a solution and thank goodness found this video, which calmly explained what to do and fixed the problem.

If you don’t feel like watching the video, here’s what I did:

1. Gather backups of everything. It is painstaking and takes a looong time, but better safe than sorry.

  • Find the most recent backup that was sent to your email via the WP-DB Backup plugin
  • Go into the PHPmyadmin in your hosting provider’s control panel, export the whole database as well as each table individually.
    [Note: The table that crashed probably won't let you export it, and will give you this ugly message: Table 'wp_posts' is marked as crashed and should be repaired]

2. in PHPmyadmin, click the checkbox next to the corrupted table (ours was wp_posts).  The table will probably say “in use”.  Use the dropdown menu at the bottom to select “repair table”.

Lessons learned

1. Backup hourly or daily and send all backups to a separate email account so you don’t have to worry about it clogging up your inbox

2. Check your blog’s overhead column in PHPmyadmin at least once a month and repair any tables with a high overhead.

Here’s to a spaz-free WordPress!

Tags: , , ,

Category: Good Blogging Practice

About Rebecca Markowitz: Rebecca Markowitz has built over 40 WordPress sites for clients as Web Marketing Manager and WordPress specialist at illuminea. illuminea is a Jerusalem-based boutique web agency. WPGarage shows my dedicated relationship with WordPress over the years - full of love, laughs, tears, growth and strong drinks. L'chaim! View author profile.

Elegant WP Themes

Comments (10)

Trackback URL | Comments RSS Feed

  1. Augel says:

    Arrrgh! Worst nightmare, considering that when this happened to me, my latest back-up was like 6 months ago… A lot of posts have gone down the drain

  2. kral oyun says:

    ERROR 1002 ? i think there is a problem with the source of video.
    Always we are face to face with DB problems – especially while updating WP or while installing a clear version – sure it will be useful for WP users…
    <i><a href=”eglence” title=”eglence”>eglence</a></i>

  3. Tim says:

    THANK YOU THANK YOU THANK YOU (and yes, I am shouting that!) worked like a charm….

  4. adhi says:

    my blog is back!! thank you very much..

  5. Rosie Peters says:

    I cannot thank you enough. You have saved me doing some drastic things.
     

  6. Soldiweb says:

    A huge thank you!!!! this article made my day!

  7. Rob Elings says:

    Hey there, thanks soooooo much! I couldn’t believe my eyes when I saw ALL my posts were gone (aaaaaaargh).
    Your solution worked after trying others, with no results. Thanks again!
    Rob

  8. Tim says:

    Just wanted to say thank you!  This article helped me restore my website and got things back to normal.  I am going to back up more often.  This was a good learning experience.  Luckily, I had to do was repair the wp_posts file and everything was good to go.  Thanks again!

Leave a Reply




If you want a picture to show with your comment, go get a Gravatar.