Repair wordpress MySQL tables using phpmyadmin
I had a heart-stopping moment a short while ago.
I was updating a blog post (just fixing some spelling errors), clicked save / update, and I got an error message that said something about there being do data and that maybe the article had been deleted.
So I refresh the page, but I get the same error.
I go back to my main blog page (which looks fine, since it is cached), but when I click on any blog post, I get a page not found error.
Next stop: the wordpress admin dashboard.
I quickly see that wordpress thinks I have zero posts, zero pages, 20 categories, and over 2000 tags
It looks like some things are ok, but all of my 850 posts have disappeared!
But I quickly remember that I setup the Computer Aid blog to perform a weekly database backup, so it shouldn’t be a total disaster.
But before I start restoring databases, I figure I’ll have a look at the database using myphpadmin:
- log into my website cpanel
- in the databases section, click on myphpadmin
- in the phpmyadmin page, click on the wordpress database
- in the list of database tables, click on the wp_posts table, and I get a message saying: wp_posts is marked as crashed and should be repaired
So it looks like I might be able to fix things without a database restore.
So I go back to the list of database tables, and at the bottom, I click on “check all”, and then to the right, I click on the “with selected” dropdown, and select “repair table” (be careful not to select “empty” or “drop” !).
After a few seconds, everything is fixed, and the Computer Aid blog is running once again.
Not a nice thing to happen! Having a WordPress backup is great but you always kind of hope you never actually have to use it as it’s not something you can easily test to check it’s ok (or is it?)
Never knew there was a repair option in there – I usually keep well away from mysql as it’s too scary 😉
Mysql have nothing scary in itself. Thanks for tips.
It is a shame I didn’t come across this post sooner. I resorted to reinstalling my whole WordPress blog and start again because of a similar issue.