一 故障描述
部署禅道后,无法登录页面。有如下报错信息:
60507 17:03:49 [ERROR] /opt/zbox/run/mysql/mysqld: Table './zentao/zt_group' is marked as crashed and last (automatic?) repair failed
禅道所有的数据库表都是使用的MyISAM存储引擎,而MyISAM存储引擎很容易导致数据库表崩溃。
二 解决办法
停掉mysql,然后使用myisamchk检查zt_group这个表的数据库文件zt_group.MYI
myisamchk是mysql自带的MyISAM存储引擎检查和修复工具
# myisamchk zt_group.MYI
Checking MyISAM file: zt_group.MYI
Data records: 11 Deleted blocks: 0
myisamchk: warning: Table is marked as crashed and last repair failed
- check file-size
myisamchk: warning: Size of datafile is: 416 Should be: 380
- check record delete-chain
- check key delete-chain
- check index reference
- check data record references index: 1
- check record links
myisamchk: error: Keypointers and record positions doesn't match
myisamchk: warning: Found 13 key parts. Should be: 11
MyISAM-table 'zt_group.MYI' is corrupted
Fix it using switch "-r" or "-o"
# myisamchk -r -o -f zt_group.MYI
- recovering (with keycache) MyISAM-table 'zt_group.MYI'
Data records: 11
重启启动mysql,然后就可以登录禅道了。
参考文档:
http://www.thinkphp.cn/code/430.html