Skip to content

Instantly share code, notes, and snippets.

@dmgig
Last active August 29, 2015 14:14
Show Gist options
  • Save dmgig/09b183bcfbf03a1d049d to your computer and use it in GitHub Desktop.
Save dmgig/09b183bcfbf03a1d049d to your computer and use it in GitHub Desktop.
mysql: momentarily enable general log file / table
# mysql: momentarily enable, then view, general log table
SET GLOBAL log_output = 'TABLE';
SET GLOBAL general_log = 'ON';
SELECT SLEEP(5);
SET GLOBAL general_log = 'OFF';
SELECT * FROM mysql.general_log;
######
# OR #
######
# mysql: momentarily enable general log file
SET GLOBAL log_output = "FILE"; // default
SET GLOBAL general_log_file = "/var/log/mysql-general.log";
SET GLOBAL general_log = 'ON';
SELECT SLEEP(5);
SET GLOBAL general_log = 'OFF';
# original: http://stackoverflow.com/questions/650238/how-to-show-the-last-queries-executed-on-mysql
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment