Skip to content

Instantly share code, notes, and snippets.

@brunoleles
Last active October 23, 2017 18:59
Show Gist options
  • Select an option

  • Save brunoleles/46cf283937a3fd19cef53d9eb2c6d0ac to your computer and use it in GitHub Desktop.

Select an option

Save brunoleles/46cf283937a3fd19cef53d9eb2c6d0ac to your computer and use it in GitHub Desktop.
MySQL general log on table

Save MySQL general log on table instead of a log file.

Turn on general log to table

SET GLOBAL general_log = 'OFF';
ALTER TABLE `mysql`.`general_log` ENGINE = MyISAM;
ALTER TABLE `mysql`.`slow_log` ENGINE = MyISAM;
SET GLOBAL general_log = 'ON';

Show last executed queries

-- limits are good friends
SELECT * FROM `mysql`.`general_log` ORDER BY event_time DESC LIMIT 100;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment