[MySQL] general_log and slow_log setting
Sep 12, 2021
Check log output type
SHOW VARIABLES LIKE '%log_output%';
- FILE : Would save the log output as file in specific path.
- TABLE : Would save the log output in table.
SET GLOBAL log_output = 'TABLE';
- Set the log output type to table.
General log
SHOW VARIABLES LIKE '%general%';
- general_log : If ON, then enable the general log collection.
- general_log_file : The path of file that save the log output.
SET GLOBAL general_log = "ON";
- Enable the general log collection.
Slow log
SHOW VARIABLES LIKE '%slow_query%';
- slow_query_log : If ON, then enable the slow log collection.
- slow_query_log_file : The path of file that save the log output.
SET GLOBAL slow_query_log = "ON";
- Enable the general log collection.