Skip to content

MySQL service logs

The MySQL service log contains errors, warnings, and informational messages generated by MySQL during startup, shutdown, or while running.

View the logs

The MySQL service log can be viewed from within the ServerPilot dashboard or through SSH.

Log file location

The MySQL service log is located at:

/var/log/mysql/error.log

Log file format

The format of each entry in the MySQL service log is:

DATE_TIME THREAD_ID [LOG_LEVEL] [ERROR_CODE] [SUBSYSTEM] LOG_MESSAGE

Fields in the log entry:

  • DATE_TIME — The date and time of the log entry.
  • THREAD_ID — The thread within MySQL that generated the log entry.
  • LOG_LEVEL — The priority or type of the log entry. Priority values can be ERROR, WARNING, or NOTE. The value SYSTEM is used for MySQL system events.
  • ERROR_CODE — The MySQL error code for the log entry.
  • SUBSYSTEM — The MySQL subsystem that generated the log entry.
  • LOG_MESSAGE — The message content of the log entry.

For example, restarting MySQL generates the following log entries which include entries generated when MySQL was shutting down followed by entries generated when MySQL was starting up.

2025-03-06T18:40:04.327119Z 0 [System] [MY-013172] [Server] Received SHUTDOWN from user <via user signal>. Shutting down mysqld (Version: 8.0.41-0ubuntu0.24.04.1).
2025-03-06T18:40:05.242425Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.41-0ubuntu0.24.04.1) (Ubuntu).
2025-03-06T18:40:05.566462Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.41-0ubuntu0.24.04.1) starting as process 1631319
2025-03-06T18:40:05.582703Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2025-03-06T18:40:05.977001Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2025-03-06T18:40:06.395957Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
2025-03-06T18:40:06.396121Z 0 [System] [MY-013602] [Server] Channel mysql_main configured to support TLS. Encrypted connections are now supported for this channel.
2025-03-06T18:40:06.466573Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Bind-address: '127.0.0.1' port: 33060, socket: /var/run/mysqld/mysqlx.sock
2025-03-06T18:40:06.467202Z 0 [System] [MY-010931] [Server] /usr/sbin/mysqld: ready for connections. Version: '8.0.41-0ubuntu0.24.04.1' socket: '/var/run/mysqld/mysqld.sock' port: 3306 (Ubuntu).

Example commands

You must be logged in as root to view the MySQL service log.

View recent MySQL service log entries

Show the most recent 100 lines in the MySQL service log.

Terminal window
sudo tail -n 100 /var/log/mysql/error.log