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

來源:互聯網
上載者:User

斷電,導致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(修複表)

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.