MySQL] Output General Query Log


General query log General query log is a log that outputs log, which outputs information about client connections to and disconnections from MySQL Server, as well as all SQL queries executed by the client.

It helps to understand SQL execution errors and which SQLs are taking how long.

setup file

The query_general.cnf is newly created.

vim /etc/my.cnf.d/query_general.cnf


Creation of log files

# touch /var/log/mysql_query_general.log

# chown mysql.mysql /var/log/mysql_query_general.log

# systemctl restart mysqld

output (result)

# tail -f /var/log/mysql_query_general.log | grep UPDATE
2021-02-25T07:28:00.435716Z 116 Query UPDATE `wp_term_taxonomy` SET `count` = 5 WHERE `term_taxonomy_id` = 21
2021-02-25T07:28:00.438642Z 116 Query UPDATE `wp_term_taxonomy` SET `count` = 6 WHERE `term_taxonomy_id` = 20


Related Articles

MySQL] Output slow query log (