WeBWorK Main Forum

Mysql table is marked as crashed and repair failed

Re: Mysql table is marked as crashed and repair failed

by Bianca Sosnovski -
Number of replies: 0
Hi Danny and Arnold,

Thank you for your help.

I tried to repair and after some initial error and some googling to find out what to do about the error, I was able to repair the table.
But if didn't work I was ready to follow Arnold's suggestion and delete the table.

Here are the commands applied:
root@webwork:~# service mysql stop
root@webwork:~# cd /var/lib/mysql/webwork
root@webwork:/var/lib/mysql/webwork# myisamchk MA119-S21-HAdner-PTN2_key.MYI
myisamchk: error: File 'MA119-S21-HAdner-PTN2_key.MYI' doesn't exist

In the directory, the table is listed with different name (I guess because of encoding of "-". This suggests that in the future we should only use underscores in the name of the courses for our server):

root@webwork:/var/lib/mysql/webwork# myisamchk MA119@002dS21@002dHAdner@002dPTN2_key.MYI
myisamchk: error: 140 when opening MyISAM-table 'MA119@002dS21@002dHAdner@002dPTN2_key.MYI'
root@webwork:/var/lib/mysql/webwork# myisamchk -r -v -f MA119@002dS21@002dHAdner@002dPTN2_key.MYI
myisamchk: error: 140 when opening MyISAM-table 'MA119@002dS21@002dHAdner@002dPTN2_key.MYI'

After a google search for the error above, a post suggested to remove the extension ".MYI" and it worked.

root@webwork:/var/lib/mysql/webwork# myisamchk -r -v -f MA119@002dS21@002dHAdner@002dPTN2_key
- recovering (with sort) MyISAM-table 'MA119@002dS21@002dHAdner@002dPTN2_key'
Data records: 44
- Fixing index 1
- Searching for keys, allocating buffer for 398 keys
- Dumping 42 keys
Data records: 42
root@webwork:/var/lib/mysql/webwork# service mysql start