Created
February 3, 2024 15:28
-
-
Save techyboy/3a5986c45ca54bf4bea70a4d3e343915 to your computer and use it in GitHub Desktop.
MYSQL Query History and Logs Details/Location
This file contains hidden or 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
| ##If general mysql logging is enabled then we can check the queries in the log file or table based what we have mentioned in the config. Check what is enabled with the following command | |
| mysql> show variables like 'general_log%'; | |
| mysql> show variables like 'log_output%'; | |
| ##If we need query history in table then | |
| Execute SET GLOBAL log_output = 'TABLE'; | |
| Execute SET GLOBAL general_log = 'ON'; | |
| ##Take a look at the table mysql.general_log | |
| ##If you prefer to output to a file: | |
| SET GLOBAL log_output = "FILE"; which is set by default. | |
| SET GLOBAL general_log_file = "/path/to/your/logfile.log"; | |
| SET GLOBAL general_log = 'ON'; | |
| ##We can also check the queries in the .mysql_history file cat ~/.mysql_history |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment