Query log is disabled by default.
To enabled it non-persistent way (will be disabled when you restart):
SET GLOBAL general_log=1;
By default, the general query log is written to ${hostname}.log in the datadir directory. In my case this is /var/lib/mysql.
SHOW VARIABLES WHERE Variable_name = "datadir";
To change the file name format:
SET GLOBAL general_log_file='mariadb.log';
To save it to TABLE instead of FILE:
SET GLOBAL log_output='TABLE';
To read from the TABLE:
SELECT * FROM mysql.general_log\G;
REFERENCES:

Leave a Reply