How to turn on MySQL General Query Logging without restarting the MySQL Server

Document ID : KB000048011
Last Modified Date : 14/02/2018
Show Technical Document Details

Description:

There will be times that restarting the mysql server is not possible and debugging needs to be done.

Solution:

To enable debug without restart:

  1. Login to the mysql client from $SPECROOT/mysql/bin
  2. Type: ./mysql --defaults-file=../my-spectrum.cnf -uroot -proot
  3. At the mysql> prompt type: set global general_log='on';

Note: On a Spectrum Report Manager host that can easily generate hundreds of queries per minute the log file will grow in size quickly.

The log file generated is created in the $SPECROOT/mysql/data directory. It is called hostname.log where hostname is the actual hostname of the system you are on.

To disable the debug: set global general_log='off';
This is also done at the mysql prompt.