mysql enable log file to collection execute SQL command

作者 admin, 五月 30, 2026, 12:44 PM

« 上一篇 - 下一篇 »

admin

-- show variables
mysql
show variables like '%log%';

-- 1. Set the destination output to FILE
SET GLOBAL log_output = 'FILE';

-- 2. Specify the custom log file path
SET GLOBAL general_log_file = '/var/log/mysql/custom_general.log';
make sure  /var/log/mysql/custom_general.log cannot be write by mysql user account

-- 3. Enable the general log
SET GLOBAL general_log = 'ON';