mysql innodb #145 错误解决

张映 发表于 2016-04-15

分类目录: mysql

标签:, ,

断电,导致innodb部分表坏了,phpmyadmin中看到该表显示为使用中,并报了,#145 - Table './shbc/user_order_logs' is marked as crashed and should be repaired

以前也解决过一次myisam表损坏,请参考:Incorrect key file for table mysql表损坏的修复方法

解决办法如下:

  1. mysql> select * from user_order_logs;  
  2. ERROR 145 (HY000): Table './shbc/user_order_logs' is marked as crashed and should be repaired  
  3. mysql> check table user_order_logs;  
  4. +----------------------+-------+----------+---------------------------------------------------------+  
  5. | Table                | Op    | Msg_type | Msg_text                                                |  
  6. +----------------------+-------+----------+---------------------------------------------------------+  
  7. | shbc.user_order_logs | check | warning  | Table is marked as crashed                              |  
  8. | shbc.user_order_logs | check | error    | Size of datafile is: 1368064         Should be: 1368188 |  
  9. | shbc.user_order_logs | check | error    | Corrupt                                                 |  
  10. +----------------------+-------+----------+---------------------------------------------------------+  
  11. 3 rows in set (0.01 sec)  
  12.   
  13. mysql> repair table user_order_logs;  
  14. +----------------------+--------+----------+------------------------------------------------------+  
  15. | Table                | Op     | Msg_type | Msg_text                                             |  
  16. +----------------------+--------+----------+------------------------------------------------------+  
  17. | shbc.user_order_logs | repair | info     | Found block that points outside data file at 1368024 |  
  18. | shbc.user_order_logs | repair | status   | OK                                                   |  
  19. +----------------------+--------+----------+------------------------------------------------------+  
  20. 2 rows in set (0.17 sec)  


转载请注明
作者:海底苍鹰
地址:http://blog.51yip.com/mysql/1790.html