534523 发表于 2016-12-7 09:04:49

mysql 5.6 myisam 引擎表损坏


[*]告警日志发现报错

2016-12-05 13:01:23 27830 /usr/sbin/mysqld: Table './user/t_customer' is marked as crashed and should be repaired
2016-12-05 13:01:23 27830 /usr/sbin/mysqld: Table './user/t_customer' is marked as crashed and should be repaired
2016-12-05 13:01:25 27830 /usr/sbin/mysqld: Table './user/t_customer' is marked as crashed and should be repaired
2016-12-05 13:01:26 27830 /usr/sbin/mysqld: Table './user/t_customer' is marked as crashed and should be repaired
2016-12-05 13:01:28 27830 /usr/sbin/mysqld: Table './user/t_customer' is marked as crashed and should be repaired
2016-12-05 13:01:29 27830 /usr/sbin/mysqld: Table './user/t_customer' is marked as crashed and should be repaired
2016-12-05 13:01:31 27830 /usr/sbin/mysqld: Table './user/t_customer' is marked as crashed and should be repaired

2.检查table

(root@localhost) > 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.修复表
(root@localhost) > repair table t_customer;
+---------------------------------+--------+----------+----------+
| Table                           | Op   | Msg_type | Msg_text |
+---------------------------------+--------+----------+----------+
| user.t_customer | repair | status   | OK       |
+---------------------------------+--------+----------+----------+
1 row in set (0.27 sec)

4.再次检查表
(root@localhost) > check table t_customer;
+---------------------------------+-------+----------+----------+
| Table                           | Op    | Msg_type | Msg_text |
+---------------------------------+-------+----------+----------+
| user.t_customer | check | status   | OK       |
+---------------------------------+-------+----------+----------+
1 row in set (0.00 sec)

(root@localhost) >

建议:
1)MySQL 5.6版本建议不要使用myisam引擎,innodb引擎完全可以取代myisam引擎,并且innodb引擎也是5.6版本的默认引擎。
2)数据库的非正常启停、以及服务器异常关机等容易造成表的损坏。

页: [1]
查看完整版本: mysql 5.6 myisam 引擎表损坏