I have MySQL running on my Ubuntu server and suddenly the MySQL Daemon was down. When trying to restart it, the restart failed due to
xxx table is marked as crashed and last (automatic ) repair failed
So then I have to truncate the table, restart MySQL and everything was fine. We had backups so we were able to recover.
Any idea why this happens and how to check what caused this?
Have a look in the error log, which would usually record a crash stacktrace . The location can be found with:
The cause can be anything from a bug in a storage engine to faulty hardware. If it repeats, you could enable query logging and try to determine whether a particular query is causing the crash.
Also, check whether you are using the latest stable mySQL packages.