Skip to content

Instantly share code, notes, and snippets.

@yevrah
Last active September 11, 2018 03:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yevrah/34b8adc3d9a40adb580b to your computer and use it in GitHub Desktop.
Save yevrah/34b8adc3d9a40adb580b to your computer and use it in GitHub Desktop.
MySQL: Log to table
-- Turn on table based logging
set global log_output = 'TABLE';
-- Turn on general log
set global general_log = 'ON';
-- Log everything to slow query log
set global log_slow_queries = 1;
set global long_query_time = 0.000001;
--Take a look at the table mysql.general_log
select * from mysql.general_log
select * from mysql.slow_log;
--Filter on the current connection
select connection_id() into @cid;
select * from mysql.`general_log` where thread_id=@cid;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment