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”.
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