mysql 5.6 myisam 引擎表损坏

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了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 


([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)数据库的非正常启停、以及服务器异常关机等容易造成表的损坏。

本文出自 “dba003” 博客,请务必保留此出处http://dba003.blog.51cto.com/12318731/1879840

以上是关于mysql 5.6 myisam 引擎表损坏的主要内容,如果未能解决你的问题,请参考以下文章

MySQL InnoDB与MyISAM存储引擎差异

Mysql存储引擎之myisam

mysql存储引擎类型都有哪些

Mysql存储引擎Myisam小结

MySQL存储引擎

MySQL存储引擎