Website encountered unexpected error - how to avoid? I'm having that typical problem of Website encountered unexpected error popping up sometimes and then after repairing watchdog MySQL table it all works find again.

My question is if there is a module that would do this automatically? Or any script that I could run from cron or from drupal?

I installed db maintenance module and thought it does that, but apparently no.

Thank you!
Does MySQL crash after that error? Either way your watchdog table is being corrupted. Are you running out of disk space? Make sure you are using InnoDB tables; MyISAM is prone to corruption.

You can check your table type by running this from a MySQL command prompt and looking for the Engine= parameter.

mysql&gt; show create table watchdog;


You can also disable dblog and enable syslog instead. Syslog writes to your system logs and is much more scalable for higher traffic sites. See if that solves your problem.