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. More about General query log
So if you have some bug or problem with database, one of the way to trace the problem in turning on this log, and check what is happening.
General query log is disabled by default, and to enable it, in Linux, you should do this:
Edit mysql configuration file:
Enable logging file, under [mysqld] section:
Save the file. Then create log file and set mysql ownership:
touch /var/log/mysql.general.log chown mysql.mysql /var/log/mysql.general.log
Now, restart the mysql service:
You can now use your applications/scripts, run queries, etc. and everything will be logged. To see real time logging, run:
tail -f /var/log/mysql.general.log
Just be careful with this, log file can become big pretty fast.
When you want to disable General query log, just delete the line you have added in my.cnf, and restart mysql server.
If you liked the post, we should get connected - follow me on Twitter