View performance_schema.error_log that contains errors,
warnings, and status updates from the Health Monitor, InnoDB storage engine, RAPID secondary
engine, replication channel, and MySQL Server.
Using a Command-Line Client 🔗
Use a command-line client such as MySQL Client or MySQL Shell to view
performance_schema.error_log.
This task requires the following:
A running DB system.
A DB system connected using MySQL Shell, MySQL Client, or any
command-line client of your choice.
Do the following to view
performance_schema.error_log using MySQL Shell or MySQL
Client:
Note
performance_schema.error_log is available in the
SQL execution mode only.
Run the following command:
SELECT * FROM performance_schema.error_log;
(Optional) To filter the logs to show only errors, run the following
command:
SELECT * FROM performance_schema.error_log WHERE PRIO='error';
(Optional) To filter the logs to only show errors from the
HEALTH subsystem, run the following command:
SELECT * FROM performance_schema.error_log WHERE SUBSYSTEM IN
('HEALTH');
You can select from the following subsystems:
HEALTH
InnoDB
RAPID
Repl
Server
(Optional) To filter on the HEALTH subsystem over a 2 hour
time interval, run the following command:
SELECT * FROM performance_schema.error_log WHERE SUBSYSTEM = 'HEALTH' AND
LOGGED > DATE_SUB(NOW(),INTERVAL 2 HOUR);
(Optional) To retrieve a count of how many instances of a specific error
occurred in a single day, run the following command:
SELECT HOUR(LOGGED), COUNT(*) FROM error_log WHERE ERROR_CODE = 'MY-010914' AND
LOGGED > DATE_SUB(NOW(),INTERVAL 1 DAY) GROUP BY HOUR(LOGGED);
(Optional) To retrieve a count of how many instances of a specific error
occurred in a week, run the following command:
SELECT DAY(LOGGED), COUNT(*) FROM error_log WHERE ERROR_CODE = 'MY-010914' AND
LOGGED > DATE_SUB(NOW(),INTERVAL 1 WEEK) GROUP BY DAY(LOGGED);
Without using any filters, you get a response similar to the following,
which displays the time the event occurred, the thread ID, priority, error code (if
present), subsystem, and text describing the event:
*************************** 1. row ***************************
LOGGED: 2021-05-10 17:09:31.132868
THREAD_ID: 0
PRIO: Note
ERROR_CODE: MY-010096
SUBSYSTEM: Server
DATA: Ignoring --secure-file-priv value as server is running with --initialize(-insecure).
*************************** 2. row ***************************
LOGGED: 2021-05-10 17:09:31.137469
THREAD_ID: 0
PRIO: Note
ERROR_CODE: MY-010949
SUBSYSTEM: Server
DATA: Basedir set to /usr/.
*************************** 3. row ***************************
LOGGED: 2021-05-10 17:09:31.141389
THREAD_ID: 0
PRIO: System
ERROR_CODE: MY-013169
SUBSYSTEM: Server
DATA: /usr/sbin/mysqld (mysqld 8.0.24-u1-cloud) initializing of server in progress as process 12383
*************************** 4. row ***************************
LOGGED: 2021-05-10 17:09:31.192341
THREAD_ID: 0
PRIO: Note
ERROR_CODE: MY-010458
SUBSYSTEM: Server
DATA: --initialize specified on an existing data directory.
*************************** 5. row ***************************
..............................
..............................