Posted: May 14th, 2018
This article assumes you are logged into the server already.
For Plesk Onyx and 12.x use plesk utility:
> to access Plesk database:
# plesk db
> to run a query in Plesk database:.
# plesk db "select * from <table>"
For Plesk 11.x and below use the following command:
> to access Plesk database:
# MYSQL_PWD=`cat /etc/psa/.psa.shadow` mysql -u admin psa
> to run a query in the Plesk database:
# MYSQL_PWD=`cat /etc/psa/.psa.shadow` mysql -u admin psa -e "select * from <table>"