[MySQL] general_log and slow_log setting

Rex Chiang
Sep 12, 2021

--

Check log output type

SHOW VARIABLES LIKE '%log_output%';
  1. FILE : Would save the log output as file in specific path.
  2. TABLE : Would save the log output in table.
SET GLOBAL log_output = 'TABLE';
  1. Set the log output type to table.

General log

SHOW VARIABLES LIKE '%general%';
  1. general_log : If ON, then enable the general log collection.
  2. general_log_file : The path of file that save the log output.
SET GLOBAL general_log = "ON";
  1. Enable the general log collection.

Slow log

SHOW VARIABLES LIKE '%slow_query%';
  1. slow_query_log : If ON, then enable the slow log collection.
  2. slow_query_log_file : The path of file that save the log output.
SET GLOBAL slow_query_log = "ON";
  1. Enable the general log collection.

--

--

No responses yet