There are tags for my.ini or my.cnf to enable the MySQL function that logs each SQL query statement received from clients and the time that query statement has submitted
Note: Remember that this log file can grow very large on a busy server and also this will slow down the performance of MySQL.
For mysql < 5.1.29:
To enable the query log, put this in /etc/my.cnf in the [mysqld] section
log = /path/to/query.log
Also, to enable it from MySQL console
SET general_log = 1;
For mysql 5.1.29+
With mysql 5.1.29+ , the log option is deprecated. To specify the log file and enable logging, use this in my.cnf:
general_log_file = /path/to/query.log
general_log = 1
Alternately, to turn on logging from MySQL console (must also specify log file location somehow, or find the default location):
SET global general_log = 1;
You can disable or enable the general query log (which logs all queries) with
SET GLOBAL general_log = 1 # (or 0 to disable)
If you found any of the information on this page helpful in anyway then please consider sharing this content with your favorite social network or by leaving your thoughts in the comment section. Thanks!