How to find out why MySQL crashed

First I would look in the MySQL Server error log before the startup messages. If there was a reason logged, it will show that. For example, MySQL Server can shut itself down if there was a code assertion failure. The log usually tells you "an assertion occurred" and then outputs a screenful of diagnostic information, including a stack trace of the assertion.

But there may not be any message logged, if the restart was caused by something so sudden that MySQL Server could not log it.

For example if someone issued a kill -9 against the mysqld process, that would cause the process to abort before it could log anything. It would be restarted automatically, but there would be no log explaining.

Another possible cause: the operating system might have restarted. Try to check the time of the last OS boot with the uptime shell command. Does that match the startup time of MySQL Server? (likely MySQL Server started within a minute or two of the OS startup)

Or the OS may be configured to respond when too much RAM is allocated by user processes, and it forcibly terminates the process using the most RAM. This is the "out of memory killer" or "OOM" feature of Linux for example. You may be able to see evidence of this happening in /var/log/messages. See https://haydenjames.io/how-to-diagnose-oom-errors-on-linux-systems/

Previous Post Next Post