How to fix “table is marked as crashed and should be repaired”

Thanks to

Power outage or a buggy mysql version could cause this error to appear:

Stops any php scripts from running etc..

mysql: Table ‘database/table’ is marked as crashed and should be repaired

To fix this, I ran this command via a shell:

$ mysqlcheck --all-databases -uroot -p

enter the root password, and it goes through checking all database tables for issues. hopefully fixing along the way :)

You may have to change root to whatever database username you have available (ie: whatever you use to login to phpmyadmin)

It any show the error, run this sql:

$ mysql -uroot -p databasename

  REPAIR TABLE tablename;

Or just jump into phpmyadmin and click on repair