Last active
September 11, 2018 03:51
-
-
Save yevrah/34b8adc3d9a40adb580b to your computer and use it in GitHub Desktop.
MySQL: Log to table
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- 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