Created
October 8, 2023 21:11
-
-
Save christophlehmann/7be88a9bde74c9be47b4b1ccfe859556 to your computer and use it in GitHub Desktop.
Follow MySQLs general log
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
#!/bin/bash | |
trap 'mysql -e "SET GLOBAL general_log=0"; exit' SIGINT SIGQUIT | |
log_file="$(mysql -N -e 'SHOW VARIABLES WHERE variable_name="general_log_file"' | awk '{print $2}')" | |
test -f $log_file && rm $log_file | |
mysql -e "SET GLOBAL general_log=1" | |
tail -f $log_file |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment