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)數據庫的非正常啓停、以及服務器異常關機等容易造成表的損壞。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章