因为宕机让IDC数据中心重启以后,发现游戏服务器程序竟然无法启动了! 查看日志,发现原来mysql某个表竟然无法读取

1
2
3
4
070412 17:51:48 [ERROR] Got error 127 when reading table './usermaster/player'
070412 17:55:50 [ERROR] Got error 127 when reading table './usermaster/player'
070412 17:58:57 [ERROR] Got error 127 when reading table './usermaster/player'
070412 18:02:50 [ERROR] Got error 127 when reading table './usermaster/player'

数据库正在进行存取的时候,突然宕机引起数据库文件损坏了!

myisamchk修复成功!启动服务器,现在运行正常!

下面说明myisamchk用法:
检查数据文件是否损坏:

1
myisamchk /usr/local/mysql/var/dbName/tblName

或者

1
myisamchk /usr/local/mysql/var/dbName/tblName.MYI

例如:

1
myisamchk /user/local/mysql/var/usermaster/player

修复数据文件:

1
2
3
myisamchk —recover —quick /usr/local/mysql/var/dbName/tblName 快速修复
myisamchk —recover /usr/local/mysql/var/dbName/tblName
myisamchk —safe-recover /usr/local/mysql/var/dbName/tblName 速度慢,但是安全有效

例如:

1
myisamchk --safe-recover /user/local/mysql/var/usermaster/player