- Go to edit the file /etc/my.cnf using any text editor. I use nano so the command for nano is as follows:$ nano /etc/my.cnf
- Find the text general_log=0 and change it to general_log=1 to turn it on. You can also use general_log=OFF or general_log=ON instead. In case its not present in the file, you can add the code below in the end of the file as a new line.[mysqld]
general_log=ON - After the changes save the file and restart mysql service so that the new settings can be read by the server. You can use the below command to restart mysql service on Cent OS.$ sudo service mysqld restart
- Once restarted your will be able to find the log file in the directory.$ /var/lib/mysqlThe file name is usually with the name of IP address of your server followed by .log like 12.345.67.89.log.
Note : If you have a hostname set for your server, the log file will be in the name of the hostname of the server.
Note : Once you are done with debugging remember to turn off the logging otherwise it will fill out your server to the last bit and will start giving unpredictable errors.