How can I view currently running MySQL queries?

You can use the “show processlist” command to view currently running queries. This is useful if you are looking to see if a query is locking a table, or if you have too many open queries, or for any other number of reasons.

On a Linux Plesk server the MySQL password is stored in /etc/psa/.psa.shadow. You would view the current query list with this command:

# mysql -uadmin -p`cat /etc/psa/.psa.shadow` -e 'show processlist' 

The output will be truncated so that everything fits onto one line. If you need to view the entire query you need to run “show full processlist.”

# mysql -uadmin -p`cat /etc/psa/.psa.shadow` -e 'show full processlist'

If you are not running Plesk, and have cPanel/WHM, by default there is no password set for user root:

# mysql -uroot -e 'show processlist'

Leave a Comment