-- 查看日志文件位置
SHOW VARIABLES LIKE 'general_log_file';
SHOW VARIABLES LIKE 'log_output';
SHOW VARIABLES LIKE 'general_log';
SHOW VARIABLES LIKE 'binlog_format';
-- 开启日志
SET GLOBAL log_output = 'TABLE';
SET GLOBAL general_log = 'ON'; #开启日志
SET GLOBAL general_log_file = '/var/log/mysql/mysql.log';
-- 查询历史sql记录
SELECT * , CONVERT (argument USING utf8) FROM mysql.general_log ORDER BY event_time DESC
#show variables like 'log_bin'
#tail -n 15 query_log.log