Created
July 6, 2020 18:52
-
-
Save Bogdaan/17c28a43c3137d8c73ef98fcc7aaf4d3 to your computer and use it in GitHub Desktop.
Mysql query 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
CREATE TABLE `slow_log` ( | |
`start_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP | |
ON UPDATE CURRENT_TIMESTAMP, | |
`user_host` mediumtext NOT NULL, | |
`query_time` time NOT NULL, | |
`lock_time` time NOT NULL, | |
`rows_sent` int(11) NOT NULL, | |
`rows_examined` int(11) NOT NULL, | |
`db` varchar(512) NOT NULL, | |
`last_insert_id` int(11) NOT NULL, | |
`insert_id` int(11) NOT NULL, | |
`server_id` int(10) unsigned NOT NULL, | |
`sql_text` mediumtext NOT NULL, | |
`thread_id` bigint(21) unsigned NOT NULL | |
) ENGINE=CSV DEFAULT CHARSET=utf8 COMMENT='Slow log' | |
CREATE TABLE `general_log` ( | |
`event_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP | |
ON UPDATE CURRENT_TIMESTAMP, | |
`user_host` mediumtext NOT NULL, | |
`thread_id` bigint(21) unsigned NOT NULL, | |
`server_id` int(10) unsigned NOT NULL, | |
`command_type` varchar(64) NOT NULL, | |
`argument` mediumtext NOT NULL | |
) ENGINE=CSV DEFAULT CHARSET=utf8 COMMENT='General log' | |
SET global general_log = 1; | |
SET global log_output = 'table'; | |
# select * from mysql.general_log |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment