WordPress database table corruption
Posted on September 10th, 2010
Seeing as I had a second case of this frustrating error today on this very site, I thought it wouldn’t hurt to post on how to fix it.
Problem
Ahhh! All your posts, pages, comments and media have disappeared, if you’re lucky you’ll get:
Table 'wp_posts' is marked as crashed
I was also tipped off in both cases to this issue, by editing a post or page and it not saving the changes (annoying in itself).
Solution
If you’ve got Cpanel with your hosting – login and go to ‘MySQL databases’ – under Modify Databases select your wordpress database in the drop down then hit ‘Repair DB’. You may need to do this more than once.
If you ain’t got cpanel – try a db management utility like MYSQL Workbench (Free! wb.mysql.com/) or Navicat (Not free).
Or if you Telnet in use a repair MySQL statement like: myisamchk -r -q wp_posts
– this will attempt to repair the table indexes.
For more detailed instructions see here:
http://dev.mysql.com/doc/refman/5.0/en/myisam-repair.html
Luckily on both occasions I didn’t lose any data. But don’t be complacent install a wordpress plugin and schedule backups for your db.
Hope this helped.