How To Enable The General MySQL Query Log on Linux

There are two potential possibilities to accomplish this: 1. Add to my.cnf file permanently or 2. include general queries for MySQL on versions higher than 5.1.29

1. Add to my.cnf file forever

vim /etc/my.cnf 
log = /home/general-query.log

Install via MySQL Console

SET general_log = 1;

Start server

systemctl restart mysqld

2. Add to my.cnf file permanently or include general queries for MySQL on versions higher than 5.1.29

general_log_file = /path/to/general-query.log

general_log = 1

Install via MySQL Console

SET general_query_log = 1;

Then create the general-query.log file in which you want to store these logs

touch general-query.log

chown -R mysql:mysql general-query.log

systemctl restart mysqld

Done! You have now successfully enabled the general MySQL query log on Linux.

Was this article helpful?

Related Articles

Leave A Comment?