MySQL can’t open file (pt. 3)

I hadn’t received any comments in the past few months, I figured it was just because I hadn’t put out any new content.

Then I realized that I couldn’t even leave a comment myself. I received an email from a buddy saying he had a similar issue.

So I checked the logs:

WordPress database error Table './{db_name}/wp_comments' 
is marked as crashed and should be repaired for query SELECT * FROM 
wp_comments WHERE comment_approved = '1' ORDER BY 
comment_date_gmt DESC LIMIT 15 made by require, require_once, 
include, get_sidebar, locate_template, load_template, require_once, 
dynamic_sidebar, call_user_func_array, WP_Widget->display_callback, 

Went to the mysql database physical location and did the following to fix it:

# myisamchk wp_comments.MYI
Checking MyISAM file: wp_comments.MYI
Data records:    3914   Deleted blocks:     347
myisamchk: warning: Table is marked as crashed
- check file-size
- check record delete-chain
- check key delete-chain
- check index reference
- check data record references index: 1
myisamchk: error: Found 3913 keys of 3914
- check record links
myisamchk: error: Keypointers and record positions doesn't match
MyISAM-table 'wp_comments.MYI' is corrupted
Fix it using switch "-r" or "-o"

# myisamchk wp_comments.MYI -r
- recovering (with sort) MyISAM-table 'wp_comments.MYI'
Data records: 3914
- Fixing index 1
- Fixing index 2
- Fixing index 3
- Fixing index 4
- Fixing index 5
- Fixing index 6


  1. gravatar

    Jeff Said,

    August 10, 2009 @ 4:28 pm

    Nice work!

  2. gravatar

    Brandon Said,

    August 11, 2009 @ 12:04 pm

    Did you upgrade wordpress and forget to run the database reconfiguration, or did this just go wonky for no apparent reason? Just curious. Nice job on the fix though.

  3. gravatar

    Raybdbomb Said,

    August 11, 2009 @ 12:55 pm

    No apparent reason. It just happens from time to time with myisam dbs (at least for me).

RSS feed for comments on this post · TrackBack URI

Leave a Comment