討論區

電腦軟硬體 / iot / 3c / 技術 => Servers => 主題作者是: admin 於 五月 30, 2026, 12:44 PM

標題: mysql enable log file to collection execute SQL command
作者: admin五月 30, 2026, 12:44 PM
-- 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';