MySQL Logs – Selecting General Query and Slow Query Log Output Destinations

By | February 8, 2014

[mysqld]

log-output=TABLE

expire_logs_days=1

general_log=1
general_log_file=/var/log/mysqld-queries.log

slow_query_log=1
slow_query_log_file=/var/log/mysqld-slow-queries.log

 

SET @old_log_state = @@global.general_log;
SET GLOBAL general_log = 'OFF';
ALTER TABLE mysql.general_log ENGINE = MyISAM;
SET GLOBAL general_log = @old_log_state;
SET GLOBAL general_log = 'ON';

SET @old_log_state = @@global.slow_query_log;
SET GLOBAL slow_query_log = 'OFF';
ALTER TABLE mysql.slow_log ENGINE = MyISAM;
SET GLOBAL slow_query_log = @old_log_state;
SET GLOBAL slow_query_log = 'ON';