…生活與工作…個人的生活雜記….

Mysql出現[ERROR] /usr/libexec/mysqld: Table ‘table_name’ is marked as crashed and should be repaired處理方式

前一陣子強制關掉video server後出現的問題

130904 15:39:57 [ERROR] /usr/libexec/mysqld: Table './rec/event' is marked as crashed and should be repaired
130904 15:39:58 [ERROR] /usr/libexec/mysqld: Table './rec/event' is marked as crashed and should be repaired
130904 15:39:58 [ERROR] /usr/libexec/mysqld: Table './rec/event' is marked as crashed and should be repaired
130904 15:40:00 [ERROR] /usr/libexec/mysqld: Table './rec/event' is marked as crashed and should be repaired
130904 15:40:00 [ERROR] /usr/libexec/mysqld: Table './rec/event' is marked as crashed and should be repaired
130904 15:40:03 [ERROR] /usr/libexec/mysqld: Table './rec/event' is marked as crashed and should be repaired
130904 15:40:03 [ERROR] /usr/libexec/mysqld: Table './rec/event' is marked as crashed and should be repaired
130904 15:40:05 [ERROR] /usr/libexec/mysqld: Table './rec/event' is marked as crashed and should be repaired
130904 15:40:05 [ERROR] /usr/libexec/mysqld: Table './rec/event' is marked as crashed and should be repaired
130904 15:40:06 [ERROR] /usr/libexec/mysqld: Table './rec/event' is marked as crashed and should be repaired
130904 15:40:06 [ERROR] /usr/libexec/mysqld: Table './rec/event' is marked as crashed and should be repaired
130904 15:40:06 [ERROR] /usr/libexec/mysqld: Table './rec/event' is marked as crashed and should be repaired
130904 15:40:06 [ERROR] /usr/libexec/mysqld: Table './rec/event' is marked as crashed and should be repaired
130904 15:40:11 [ERROR] /usr/libexec/mysqld: Table './rec/event' is marked as crashed and should be repaired

解決方式:

myisamchk -s /var/lib/mysql/*/*.MYI
myisamchk -r /var/lib/mysql/rec/event.MYI

myisamchk: MyISAM file /var/lib/mysql/rec/event.MYI
myisamchk: warning: 1 client is using or hasn't closed the table properly
MyISAM-table '/var/lib/mysql/rec/event.MYI' is usable but should be fixed
myisamchk: MyISAM file /var/lib/mysql/rec/mail.MYI
myisamchk: warning: 1 client is using or hasn't closed the table properly
MyISAM-table '/var/lib/mysql/rec/mail.MYI' is usable but should be fixed
myisamchk: MyISAM file /var/lib/mysql/rec/sessions.MYI
myisamchk: warning: 1 client is using or hasn't closed the table properly
MyISAM-table '/var/lib/mysql/rec/sessions.MYI' is usable but should be fixed

myisamchk -r –update-state /var/lib/mysql/rec/event.MYI
service mysqld restart

done.