Mysql innodb #145 troubleshooting caused by power loss

Source: Internet
Author: User

When the power is down, some innodb tables are broken. phpmyadmin shows that the Table is in use and reports #145-Table '. /shbc/user_order_logs 'is marked as crashed and shoshould be retried red.

The myisam table was damaged once in the past. for details, refer to the repair method for Incorrect key file for table mysql table corruption.

The solution is as follows:


Mysql> select * from user_order_logs;
ERROR 145 (HY000): Table './shbc/user_order_logs' is marked as crashed and shoshould be retried Red
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 shocould be: 1368188 |
| Shbc. user_order_logs | check | error | UPT |
+ ---------------------- + ------- + ---------- + --------------------------------------------------------- +
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)

If you do not know how to use the command, you can install phpmyadmin and fix it.

In phpmyadmin, select the database table to be optimized, and select repair table in the check box to optimize the data table. The following figure shows a drop-down menu at the bottom of the window, that is, under the list. Select Repair Table (Repair Table)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.