Two days ago, out of nowhere, a particular table in the Wordpress in hongkiat.com went corrupted. The ‘wp_comments‘ table of the Wordpress database just crashed without signs, warnings nor error messages. So how did I came to know? Here are the symptoms:
- If you try to back up your database, you’ll be thrown with this error message – wp_comments is marked as crashed and should be repaired when using LOCK TABLES
- Recent comments widget appears blank.
- Top commenter widget appears blank.
- Comment posted will not be written into DB, therefore will not be shown.
- Comments section in WP Admin appears to have zero records.
After searching the Internet high and low in hoping to find similar cases to help me identify and fix the problem, I end up with nothing. So I tried it my way and luckily enough, I managed to solved it. I thought writing the entry out will not only help those who suffered the same, also keep myself reminded just in case I hit on this error again in the future.
The fix / Solution
To fix this, you must have access to the wordpress database, either via PhpMyAdmin or Secure Shell (SSH). Most shared hosting account comes with phpMyAdmin, but either option you should be extremely careful because you dealing with the database. Any wrong move will cause more data lost.
PhpMyAdmin

In PhpMyadmin, select the Wordpress database and look for the error table. In my case, the ‘wp_comments‘ table. Check it, and scroll all the way down and look for ‘With selected‘ drop-down box. Select Repair table and things should be alright.
Secure Shell

- Login to your shell
- Enter ‘mysql -u username -p database_name‘ to access databases
- Enter ’show databases;’ to view all databases
- Enter ‘use database_name;‘ to engage the database
- Enter ‘show tables;‘ to show all tables within the database
- Enter ‘check table wordpress_table_name‘ to verify this is the corrupted table
- Fix it with ‘repair table wordpress_table_name‘
- Enter ‘check table wordpress_table_name‘ again to make sure it’s fixed
Step 3 and 5 are not necessary if you are familiar with your databases and tables. Hope this helps.
Related Contents |
Sponsors |
|
Posted by hongkiat in Wordpress, Wordpress Tips Tricks , at 05.31.08 |
|






















Comments
zaki blogjer June 1st, 2008
I had used similar trick when my article directory load too slow when there are too many connections. It’s not down, but it just shows blank. The subdirectory working fine. Usually I repair, optimize and check at once
Replyzaki blogjer June 2nd, 2008
hongkiat. you can use this plugin as well.
http://lesterchan.net/wordpress/readme/wp-dbmanager.html
Replyhongkiat June 2nd, 2008
@zaki Thanks, that’s a good plugin :-)
Replymarkez linda March 8th, 2009
Can you provide more information on this?
ReplyKaitlyn July 18th, 2009
Laptop Stands and Docking Stations, What is the Difference ?
Replydfgyh November 20th, 2009
check
Reply