Skip to content

Instantly share code, notes, and snippets.

@daniDLL
Last active March 2, 2020 15:47
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save daniDLL/66eb31ae5a66e8808275975b43b25cff to your computer and use it in GitHub Desktop.
Save daniDLL/66eb31ae5a66e8808275975b43b25cff to your computer and use it in GitHub Desktop.
Show executed queries in real time
## Show real-time
watch -n1 'mysql -u root -ppassword --execute="SHOW FULL PROCESSLIST"'
## Show real-time and pipe all info to file
watch -t -n1 '(mysql -h dbhost -u dbuser dbname -ppassword --execute="SHOW FULL PROCESSLIST") | tee -a mysql-process-list.log'
## Show slow queries real-time and pipe all info to file
watch -t -n1 '(mysql -h dbhost -u dbuser dbname -ppassword --execute="SELECT * FROM information_schema.processlist WHERE TIME > 5 ORDER BY TIME DESC") | tee -a /tmp/mysql-process-list.log'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment