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表损坏的修复方法

解决办法如下:

mysql> select * from user_order_logs;
ERROR 145 (HY000): Table './shbc/user_order_logs' is marked as crashed and should be repaired
mysql> check table user_order_logs;
+----------------------+-------+----------+---------------------------------------------------------+
| Table                | Op    | Msg_type | Msg_text                                                |
+----------------------+-------+----------+---------------------------------------------------------+
| shbc.user_order_logs | check | warning  | Table is marked as crashed                              |
| shbc.user_order_logs | check | error    | Size of datafile is: 1368064         Should be: 1368188 |
| shbc.user_order_logs | check | error    | Corrupt                                                 |
+----------------------+-------+----------+---------------------------------------------------------+
3 rows in set (0.01 sec)

mysql> repair table user_order_logs;
+----------------------+--------+----------+------------------------------------------------------+
| Table                | Op     | Msg_type | Msg_text                                             |
+----------------------+--------+----------+------------------------------------------------------+
| shbc.user_order_logs | repair | info     | Found block that points outside data file at 1368024 |
| shbc.user_order_logs | repair | status   | OK                                                   |
+----------------------+--------+----------+------------------------------------------------------+
2 rows in set (0.17 sec)


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