Plesk: listing all the database account info (dbname/username/password)

There’s no single command (yet) to list all the database users/passwords, but the information is stored in the psa database – so you can just retrieve it from there.

Note (2011): this works because Plesk 8/9 kept the passwords in plain text. As of Plesk 10 and later they’re encrypted (sym, AES) or hashed (crypt) in the accounts table, so on a current Plesk this query still returns the database names and logins, but the password column won’t come back as readable cleartext.

First, log into the MySQL database.

# mysql -uadmin -p`cat /etc/psa/.psa.shadow` psa

mysql>

And copy/paste the following query into it.

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;

It should look similar to this:

mysql> 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;

+-–-–-–-–-–-–+-–-–-–-–-–-–-–-–+-–-–-–-–-–-–+-–-–-–-–-–-–-—-+

| domain_name      | database_name          | login            | password              |

+-–-–-–-–-–-–+-–-–-–-–-–-–-–-–+-–-–-–-–-–-–+-–-–-–-–-–-–-—-+

| mattiasgeniar.be | mattiasgeniar_projects | mattiasg_xxxxxxx | blablabla             |

| mattiasgeniar.be | mattiasgeniar_blog     | mattiasg_xxxxxxx | blablabla             |

That could help you in troubleshooting some database issues.