记一次mysql故障: is marked as crashed and should be repaired

机器断电导致mysql不正常停服, 日志报错:
160924 20:24:17 [ERROR] /usr/libexec/mysqld: Table './Zblog/zbp_post' is marked as crashed and should be repaired
160924 20:24:17 [ERROR] /usr/libexec/mysqld: Table './Zblog/zbp_post' is marked as crashed and should be repaired
160924 20:24:57 [ERROR] /usr/libexec/mysqld: Table './Zblog/zbp_post' is marked as crashed and should be repaired
160924 20:24:57 [ERROR] /usr/libexec/mysqld: Table './Zblog/zbp_post' is marked as crashed and should be repaired
160924 20:24:58 [ERROR] /usr/libexec/mysqld: Table './Zblog/zbp_post' is marked as crashed and should be repaired
160924 20:24:58 [ERROR] /usr/libexec/mysqld: Table './Zblog/zbp_post' is marked as crashed and should be repaired
160924 20:25:09 [ERROR] /usr/libexec/mysqld: Table './Zblog/zbp_post' is marked as crashed and should be repaired
160924 20:25:09 [ERROR] /usr/libexec/mysqld: Table './Zblog/zbp_post' is marked as crashed and should be repaired
160924 20:25:23 [ERROR] /usr/libexec/mysqld: Table './Zblog/zbp_post' is marked as crashed and should be repaired
160924 20:25:23 [ERROR] /usr/libexec/mysqld: Table './Zblog/zbp_post' is marked as crashed and should be repaired
160924 20:25:24 [ERROR] /usr/libexec/mysqld: Table './Zblog/zbp_post' is marked as crashed and should be repaired
160924 20:25:24 [ERROR] /usr/libexec/mysqld: Table './Zblog/zbp_post' is marked as crashed and should be repaired
160924 20:25:29 [ERROR] /usr/libexec/mysqld: Table './Zblog/zbp_post' is marked as crashed and should be repaired
160924 20:25:29 [ERROR] /usr/libexec/mysqld: Table './Zblog/zbp_post' is marked as crashed and should be repaired
160924 20:25:40 [ERROR] /usr/libexec/mysqld: Table './Zblog/zbp_post' is marked as crashed and should be repaired
160924 20:25:40 [ERROR] /usr/libexec/mysqld: Table './Zblog/zbp_post' is marked as crashed and should be repaired
160924 20:25:42 [ERROR] /usr/libexec/mysqld: Table './Zblog/zbp_post' is marked as crashed and should be repaired
这段错误提示  ./Zblog/zbp_post 有问题

于是进行修复

找到mysql的安装目录的bin/myisamchk工具,在命令行中输入:
[root@VM_132_47_centos ~]# myisamchk -c -r /var/lib/mysql/Zblog/zbp_post.MYI
- recovering (with sort) MyISAM-table '/var/lib/mysql/Zblog/zbp_post.MYI'
Data records: 77
- Fixing index 1
- Fixing index 2

1 个评论

或者你直接repaired 表应该也可以吧。

要回复文章请先登录注册