View Active MySQL Quries

From Zanecorpwiki

Jump to: navigation, search

You can check active MySQL queries from within the mysql interface with:

show processlist;

and

show full processlist;

TODO: what's the diff?

From without, one can use the mysqladmin:

mysqladmin -u [adminuser] -p pr

How many queries is a user running?

mysqladmin -u [adminuser] -p pr | awk -F\| {'print $3'} | sort -nk1 | awk -F_ {'print $1'} |uniq -c |sort

Which database is most heavily used?

mysqladmin -u [adminuser] -p pr | awk -F\| {'print $3'} | sort -nk1 |uniq -c |sort

Thanks to the Rambling Sysadmin.

Personal tools