Mysql Troubleshooting

From Kb

Jump to: navigation, search

If you have a table that crashes or becomes corrupt (often due to the dbms being shutdown improperly) you might see an error like this:

ERROR 145 (HY000): Table './rain_blog_db/wp_users' is marked as crashed and should be repaired

In which case you should run a check on it. It is best to shutdown your database server before you run a repair on the files unless you are running the repair from the client.

If you know that is the only table that has problems you can just run the following command on it:

myisamchk -r /path/to/databases/tablename.MYI

If you suspect other tables may have been corrupted also you can try this command to recursively check all the tables in all the database directories:

find /path/to/databases/ -type f -name '*.MYI' -exec myisamchk {} \;