萬盛學電腦網

 萬盛學電腦網 >> 數據庫 >> mysql教程 >> 掉電導致mysql innodb #145 錯誤解決解決

掉電導致mysql innodb #145 錯誤解決解決

mysql innodb #145 錯誤是因為表損壞了,既然是表壞了我們只要修改就可以了,具體的修復我們可以使用repair命令了,具體的例子如下所示,希望能夠對各位有幫助。

斷電,導致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) 

當然如果不知道使用命令可以安裝一個phpmyadmin 然後進行修復

我們在phpmyadmin中,勾選要進行優化操作的數據庫表,在復選框中選擇:修復表,就完成了數據表的優化。如下圖在窗口最下方即列表下方,有一個下拉式菜單,在其中選擇Repair Table(修復表)

copyright © 萬盛學電腦網 all rights reserved