List all databases and users from Plesk MySQL

This tutorial is for these who want to gather or just see the databases and the users under Plesk using MySQL command.

For that you must have to login to the Plesk server as ‘root’ and there to execute MySQL query with ‘psa’ table active.

I presume you are already logged to your server via SSH or console.

Now execute this command:

If you have only ‘sudo’ access the above command will not work since the ‘.psa.shadow’ file will not be accessible, even that you are entering the ‘sudo’ password.

Instead you can use:

The next MySQL command will list all Plesk databases and assigned users.

The above command is paste from my command line which shows the consecutive MySQL query, so take in mind if you cannot copy it straight since there are some characters which will generate errors.

Here is the MySQL command showing Plesk databases easy to be copied.

The list of the Plesk databases and their users result should look like this:

In my example the domain is always �mydomain.com�, but that is because I have only one domain setup in plesk. If you have others they will be listed in the same table with all the Plesk database users.

If you receive errors, the most common issues could be either the Plesk database (psa) is not selected or you do not have access to the Plesk MySQL database.

In case the database is not changed and you are not really sure how to make it active you may relay to this tutorial MySQL commands.
Regarding the access to the server contact your hosting provider .

Filed Under: Plesk Control Panel

Anthony Gee About the Author: Anthony G. is an IT specialist with more than 9 years of solid working experience in the Web Hosting industry. Currently works as server support administrator, involved in consultative discussions about Web Hosting and server administration. One of the first writers in the Onlinehowto.net website, now writing for Free Tutorials community - he is publishing tutorials and articles for the wide public, as well as specific technical solutions.

Comments (4)

  1. I was looking for a way to list the DB’s without logging into Plesk since I’m connected to a client’s site on my cell phone using ConnectBot’s SSH client for Android, and this was PERFECT!!! Thanks so much for this article! =0)

  2. Denon says:

    Thanks! This helped me when I was having problems connecting to the Plesk tables when using this guide:
    (http://www.simplesteps.com/content/view/89/1/)

    mysql> use plesk;

    was not working but after using the command

    mysql -uadmin -pcat /etc/psa/.psa.shadow psa

    I was able to select from the Plesk tables

    :-)

  3. Tony says:

    You are welcome Denon . The reason is because the database is called ‘psa’ not ‘plesk’

  4. Tony says:

    One line execution
    mysql -uadmin -p cat /etc/psa/.psa.shadow -Dpsa -e”SELECT domains.name AS domain_name, data_bases.name AS database_name, db_users.login, accounts.password FROM data_bases, db_users, domains, accounts WHERE data_bases.dom_id = domains.id AND db_users.db_id = data_bases.id AND db_users.account_id = accounts.id ORDER BY domain_name;”

Leave a Reply