MySQL Query Log

If you need details about whats going on within your MySQL instance, the query log is very useful, even though it’s not recommended for permanent use, due to the performance impact and disk space consumption.

With some luck you are already running MySQL in release 5.1 or later, so you can activate the query log on the fly:

  • Log in to your MySQL instance, e.g. mysql --defaults-file=/etc/mysql/debian.cnf, if you are using MySQL in Debian.
  • Set the log target: set global general_log_file='/var/tmp/mysql.log'
  • Activate the log file: set global general_log=1
  • You can end verbose logging (and you should really restrict it on production) with: set global general_log=0