天天看点

解决MySQL Table '***' is marked as crashed and should be repaired问题

现象:

BUG管理系统无法登陆

问题:

检查后端日志显示——Table 'zt_action' is marked as crashed and should be repaired

解决方法(2种)

1、先使用mysqlcheck来解决

备份重要数据库(表)

[root@ST-Server data]# mysqlcheck -uroot -p zentao111 --auto-repair
Enter password:
zentao111.zt_action                                OK
zentao111.zt_bug                                   OK
zentao111.zt_build                                 OK
zentao111.zt_burn                                  OK
zentao111.zt_case                                  OK
zentao111.zt_caseStep                              OK
zentao111.zt_company                               OK
zentao111.zt_config                                OK
zentao111.zt_dept                                  OK
zentao111.zt_doc                                   OK
zentao111.zt_docLib                                OK
zentao111.zt_effort                                OK
zentao111.zt_extension                             OK      

2、使用命令myisamchk修复数据库的MYI文件

[root@ST-Server ~]# myisamchk -c -r /usr/local/mysql/data/zentao111/zt_action.MYI
- recovering (with sort) MyISAM-table '/usr/local/mysql/data/zentao111/zt_action.MYI'
Data records: 21810
- Fixing index 1
- Fixing index 2      

     如果上述操作还不行,就使用 -f 强制执行修复;即

继续阅读