mysql query log – Log all queries on mysql database
To enable the query log, put this in /etc/my.cnf in the [mysqld] section
log = /path/to/query.log #works for mysql < 5.1.29Also, to enable it from MySQL console
SET general_log = 1;Remember that this logfile can grow very big on a busy server.
update:
With mysql 5.1.29+ , the log option is deprecated. To specify the logfile use
general_log_file=/path/to/query.logAlso, to enable it from MySQL console
SET global general_log = 1;instead. See http://dev.mysql.com/doc/refman/5.1/en/query-log.html
If you don't want or cannot restart the MySQL server you can proceed like this on your running server:
SET global general_log = 1;
SET global log_output = 'table';- View the log
select * from mysql.general_log- Disable Query logging on the database
SET global general_log = 0;Should be noted that 'table' is meant to be entered literally, and not replaced with a table name in your database.