MySQL table marked as crashed and should be repaired

If you are getting the following error message:

Table ‘jos151_session’ is marked as crashed and should be repaired

this means mysql service was terminated while this particular table was open to write some data into it. After mysql start/restart some data is in inconsistent state.

To fix the problem you need to log into mysql, select necessary database and run:

# CHECK TABLE jos151_session;
# REPAIR TABLE jos151_session;

If more than one table is broken, you may run check/repair for all tables in databases with bash command line and providing root password:

mysqlcheck -A -or -p