- 告警日志发现报错
2016-12-05 13:01:23 27830 [ERROR] /usr/sbin/mysqld: Table ‘./user/t_customer‘ is marked as crashed and should be repaired
2016-12-05 13:01:23 27830 [ERROR] /usr/sbin/mysqld: Table ‘./user/t_customer‘ is marked as crashed and should be repaired
2016-12-05 13:01:25 27830 [ERROR] /usr/sbin/mysqld: Table ‘./user/t_customer‘ is marked as crashed and should be repaired
2016-12-05 13:01:26 27830 [ERROR] /usr/sbin/mysqld: Table ‘./user/t_customer‘ is marked as crashed and should be repaired
2016-12-05 13:01:28 27830 [ERROR] /usr/sbin/mysqld: Table ‘./user/t_customer‘ is marked as crashed and should be repaired
2016-12-05 13:01:29 27830 [ERROR] /usr/sbin/mysqld: Table ‘./user/t_customer‘ is marked as crashed and should be repaired
2016-12-05 13:01:31 27830 [ERROR] /usr/sbin/mysqld: Table ‘./user/t_customer‘ is marked as crashed and should be repaired
2.检查table
([email protected]) [user]> check table t_customer;
+---------------------------------+-------+----------+----------------------------------------------------------+
| Table | Op | Msg_type | Msg_text |
+---------------------------------+-------+----------+----------------------------------------------------------+
| user.t_customer | check | warning | Table is marked as crashed |
| user.t_customer | check | warning | 2 clients are using or haven‘t closed the table properly |
| user.t_customer | check | error | Checksum for key: 2 doesn‘t match checksum for records |
| user.t_customer | check | error | Corrupt |
+---------------------------------+-------+----------+----------------------------------------------------------+
4 rows in set (0.10 sec)
3.修复表
([email protected]) [user]> repair table t_customer;
+---------------------------------+--------+----------+----------+
| Table | Op | Msg_type | Msg_text |
+---------------------------------+--------+----------+----------+
| user.t_customer | repair | status | OK |
+---------------------------------+--------+----------+----------+
1 row in set (0.27 sec)
4.再次检查表
([email protected]) [user]> check table t_customer;
+---------------------------------+-------+----------+----------+
| Table | Op | Msg_type | Msg_text |
+---------------------------------+-------+----------+----------+
| user.t_customer | check | status | OK |
+---------------------------------+-------+----------+----------+
1 row in set (0.00 sec)
([email protected]) [user]>
建议:
1)MySQL 5.6版本建议不要使用myisam引擎,innodb引擎完全可以取代myisam引擎,并且innodb引擎也是5.6版本的默认引擎。
2)数据库的非正常启停、以及服务器异常关机等容易造成表的损坏。