Crash! Burn! How to repair tables in the WordPress database
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!
Category: Good Blogging Practice










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
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>
[...] good-blogging-practice/crash-burn-how-to-repair-tables-in-the-wordpress-d… [...]
THANK YOU THANK YOU THANK YOU (and yes, I am shouting that!) worked like a charm….
my blog is back!! thank you very much..
I cannot thank you enough. You have saved me doing some drastic things.
A huge thank you!!!! this article made my day!
[...] good-blogging-practice/crash-burn-how-to-repair-tables-in-the-wordpress-database… http://www.howtodothings.com/video/fixing-wp-mysql-crashed-tables [...]
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
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!
Well…I had this same problem 2 days consecutive. Each post database crashed on my 2 blogs, both hosted on my main website root.
)) It is very effective.
Pfuh…that was very very stressy at first sight.
This repair function saved twice my precious online datas
But, when I was searching for a solution, I also read around that in some cases , the simple repair function was not enough for various dark reasons.
There is the real deal.
So yes. I totally agree : put the WP back-up plugin + back up your MySql database very regularly if you post often.
But, now …as I doubt it will not happen again, I would like to know WHY ????
There must be a reason…I found out that space could be a problem, a plugin conflict..
Did you find out the reason ?
If it is a space problem, how do I check this ?
Thank you and wishing it will not again,
Cheers,
You guys are awesome. I have been freaking out since this morning. For some reason this happened to my posts table as well. Thanks so much for sharing.
I don’t know how to thank you enough. You just saved my 1 and half years of work. Great finding, thanks again.
Your Tip Worked on WordPress Blog that had Crashed. Thanks.
[...] “error establishing a database connection” even after the reboot. After many tries, this worked for me. Basically, my options table (prefix_options) was broken. Fixing it using phpMyAdmin [...]