MySQL Can’t Open File
I left on my honeymoon and all sorts of stuff goes wrong!
I was getting the MySQL error message:
#1016 - Can’t open file: ‘wp_comments.MYI’ (errno: 144)
Where wp_comments holds all of the comments for my site. So of course this is a major problem.
I was a little frantic, but it turns out it was an easy fix. I checked the file with the tool ‘myisamchk’:
# myisamchk wp_comments.MYI
Checking MyISAM file: wp_comments.MYI
Data records: 8385 Deleted blocks: 0
myisamchk: warning: Table is marked as crashed and last repair failed
- check file-size
- check record delete-chain
- check key delete-chain
- check index reference
- check data record references index: 1
myisamchk: error: Found 8384 keys of 8385
- check record links
myisamchk: error: Found wrong record at 38231804
MyISAM-table 'wp_comments.MYI' is corrupted
Fix it using switch "-r" or "-o"
[root@sam]#
So I simply did what it said, brought down MySQL, repaired, brought MySQL back up and it worked, whala.
[root@sam]# /usr/local/etc/rc.d/mysql-server.sh stop
Stopping mysql.
Waiting for PIDS: 889, 889, 889.
[root@sam]# myisamchk -r wp_comments.MYI
- recovering (with sort) MyISAM-table ‘wp_comments.MYI’
Data records: 8385
- Fixing index 1
Key 1 - Found wrong stored record at 38231804
- Fixing index 2
- Fixing index 3
- Fixing index 4
Data records: 8384
[root@sam]# /usr/local/etc/rc.d/mysql-server.sh start
Starting mysql.
[root@sam]#
And it works now…
It’s a good thing too, because I didn’t have a very recent backup…

Joe Said,
June 4, 2006 @ 4:40 pm
Dude, kick ass! Good work on the fix. I was in panic mode, as my site was down as well.
Raybdbomb Said,
June 4, 2006 @ 4:52 pm
Yours was a different issue…
Joe Said,
June 4, 2006 @ 9:38 pm
Arg, well thanks for fixing it
Teh Blarg » MySQL Can’t Open File (again) Said,
July 25, 2006 @ 11:40 pm
[...] Mysql Version Compatibility IssuesMySQL Can’t Open Filemysql error dealing with permissionsMysql install on FreeBSDA sql search algorithm Games Playing WC3: FT (PC) [...]