TECHIES WORLD

For Techs.... Techniques.... Technologies....

CpanelLinuxMysql

How to enable Mysql general query log

The general query log is a general record of what mysqld is doing. The server writes information to this log when clients connect or disconnect, and it logs each SQL statement received from clients. The general query log can be very useful when you suspect an error in a client and want to know exactly what the client sent to mysqld.

General query log is disabled by default and we can use the below steps to enable it.

Step1: Open mysql config file /etc/my.cnf and enter the following lines

general_log_file = /var/log/mysql.general.log
general_log = 1

Step2: Save the config file

Step3: Create the log file

# touch /var/log/mysql.general.log

Step4: Change the ownership of log file

# chown mysql.mysql /var/log/mysql.general.log

Step5: Restart mysql service

# /etc/init.d/mysql restart

Leave a Reply