MySQL is a very common choice for webmasters and is pretty good and stable database. At times if the database is not shutdown cleanly (due to machine reboot etc.) it can leave the database in an unstable state. One of the very common symptoms is where it would say that a table(s) has been marked as crash.<!>
The following error shows up in the logs or in website where in mysql error logging is enabled.
SQL show index from `watchdog` failed : Table ‘./justsikh/watchdog’ is marked as crashed and last (automatic?) repair failed
In such cases we can repair the table to avoid data loss as show below:
Basically login to mysql with username/password, connect the your database (justsikh in this case) and issue the repair table command.
mvohra@livrona:~/projects/livrona/public/webservices/apps$ mysql -u root -p
Welcome to the MySQL monitor. Commands end with ; or g.
Your MySQL connection id is 760431
Server version: 5.1.49-1ubuntu8.1 (Ubuntu)
Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL v2 license
Type ‘help;’ or ‘h’ for help. Type ‘c’ to clear the current input statement.
mysql> connect justsikh
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Connection id: 760432
Current database: justsikh
mysql> repair table watchdog;
| Table | Op | Msg_type | Msg_text |
| justsikh.watchdog | repair | warning | Number of rows changed from 147323 to 147298 |
| justsikh.watchdog | repair | status | OK |
2 rows in set (4.39 sec)
Now your table has been repaired and good till next time if it happens again.[pb_builder]