Auto check and repair the MyISAM tables

The last two days a table of the database which is used by my blog had a crashed MyISAM table, and this prevented my blog to be accessible.

The corresponding log of MySQL server:

[ERROR] /usr/libexec/mysqld: Table './webplay_db/prefix_options' is marked as crashed and should be repaired.

I have no monitoring tool set for my vps yet (it’s on my to do list 😛 , to set nagios) so I realised that my blog is not up when I tried to visit it. That’s  why a less time consuming action to solve this problem (than setting nagios) is to add a script in the crontab,  to check and repair tables . An every hour check is  good enough for this purpose:

/usr/bin/mysqlcheck --all-databases -uroot -ppassword -r

I hope a MyISAM table crash not being the reason for my blog's downtime anymore!