How to see whats running in MySQL

Short List
Show Processlist;

Detailed List
Show full Processlist;

If you like the linux TOP or HTOP try this:

watch -n1 ‘echo “show processlist” | mysql -uyourusername -pyourpass | grep -v “show processlist”‘

  • Save it as a .file. but make sure the password is secure. I usually makeup a monitoring user just for this with VERY limited permissions

→So, here is what’s going on:

watch -n1  is how often it refreshes. So, if you want it to refresh every five seconds do this –>  watch -n1
I guess if you like to take the long route you can also do this –> watch –interval=5  for five seconds, but why…. really why?
then watch is ‘show processlist’ is piped to a mysql connection. So if you want this to be more detaileed then use the show full processlist
grep -v is like a reverse grep, meaning it will show you everything NOT like the search ‘show processlist’ … this is because I don’t want to see my own connection monitoring things.

Tagged with:
Posted in Data Warehouse, ETL, Linux, MySQL, SQL

Leave a Reply