mysql nastiness
The other day, I thoroughly cleansed my mt_comments table. Let me thank the comment-spammers for the 50000+ posts…. Then, I noticed some funny error messages upon trying to post an entry the next day. I would get this error at the top of any page using pear’s DB.php class:
SQL/DB: Error ... something ... mt_comment.MYD (Errno: 145)
Some quick google searches revealed it could be a corrupt table. I found something in the mysql reference manual, entitled: How to Repair Tables.
I performed a quick check on the file in question:
[root@ns root]# myisamchk /var/lib/mysql/mtseebq/mt_comment.MYI Checking MyISAM file: /var/lib/mysql/mtseebq/mt_comment.MYI Data records: 3015 Deleted blocks: 21793 myisamchk: warning: Table is marked as crashed myisamchk: warning: 2 clients is using or hasn't closed the table properly - check file-size - check key delete-chain - check record delete-chain - check index reference - check data record references index: 1 myisamchk: error: Found 3014 keys of 3015 - check record links myisamchk: error: Keypointers and record positions doesn't match MyISAM-table '/var/lib/mysql/mtseebq/mt_comment.MYI' is corrupted Fix it using switch "-r" or "-o"
Bingo! So, I decided to opt for a repair (could have used the -q option) and I skipped a step where I made a backup of the .MYD and .MYI files.
[root@ns root]# myisamchk -r /var/lib/mysql/mtseebq/mt_comment.MYI - recovering (with sort) MyISAM-table '/var/lib/mysql/mtseebq/mt_comment.MYI' Data records: 3015 - Fixing index 1 - Fixing index 2 - Fixing index 3 - Fixing index 4 [root@ns root]#
Done. Then, I almost forgot to:
[root@ns root]# /etc/init.d/mysqld start Starting MySQL: [ OK ]
Working again for now. But I need a new server! Who wants in with me?
