mysql 5.6 myisam 引擎表损坏-阿里云开发者社区

开发者社区> 数据库> 正文

mysql 5.6 myisam 引擎表损坏

简介:
  1. 告警日志发现报错

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 


(root@localhost) [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.修复表

(root@localhost) [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.再次检查表

(root@localhost) [user]> 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) [user]>


建议: 

1)MySQL 5.6版本建议不要使用myisam引擎,innodb引擎完全可以取代myisam引擎,并且innodb引擎也是5.6版本的默认引擎。

2)数据库的非正常启停、以及服务器异常关机等容易造成表的损坏。










本文转自 roidba 51CTO博客,原文链接:http://blog.51cto.com/roidba/1879840,如需转载请自行联系原作者

版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。

分享:
数据库
使用钉钉扫一扫加入圈子
+ 订阅

分享数据库前沿,解构实战干货,推动数据库技术变革

其他文章