snippetsqlMinor
How to find out why MySQL crashed?
Viewed 0 times
whyhowcrashedmysqlfindout
Problem
My DB crashed today and this is what I see in
Nothing else. There is also an empty
How can I find out why it crashed?
/var/log/mysql/error.log:2022-11-14T16:55:20.879027Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.31-0ubuntu0.20.04.1) starting as process 288116
2022-11-14T16:55:20.889262Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2022-11-14T16:57:25.957099Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2022-11-14T16:57:26.248124Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
2022-11-14T16:57:26.248154Z 0 [System] [MY-013602] [Server] Channel mysql_main configured to support TLS. Encrypted connections are now supported for this channel.
2022-11-14T16:57:26.285735Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Bind-address: '127.0.0.1' port: 33060, socket: /var/run/mysqld/mysqlx.sock
2022-11-14T16:57:26.286101Z 0 [System] [MY-010931] [Server] /usr/sbin/mysqld: ready for connections. Version: '8.0.31-0ubuntu0.20.04.1' socket: '/var/run/mysqld/mysqld.sock' port: 3306 (Ubuntu).Nothing else. There is also an empty
error.log.1 file there.How can I find out why it crashed?
Solution
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
Another possible cause: the operating system might have restarted. Try to check the time of the last OS boot with the
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/
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/
Context
StackExchange Database Administrators Q#319669, answer score: 2
Revisions (0)
No revisions yet.