Get your server issues fixed by our experts for a price starting at just 25 USD/Hour. Click here to register and open a ticket with us now!

Author Topic: How to find the subscription and database names by database user  (Read 1579 times)

0 Members and 1 Guest are viewing this topic.

sibij

  • Guest
Connect to the server via SSH and execute the following command:

Code: [Select]
# MYSQL_PWD=`cat /etc/psa/.psa.shadow` mysql -u admin psa -Ne"SELECT db_users.login, data_bases.name, domains.name FROM db_users LEFT JOIN domains ON db_users.dom_id=domains.id LEFT JOIN data_bases ON data_bases.id=db_users.id WHERE db_users.login LIKE 'username'"
To find domain name by database name:

Code: [Select]
# MYSQL_PWD=`cat /etc/psa/.psa.shadow` mysql -u admin psa -Ne"SELECT domains.name FROM domains LEFT JOIN data_bases ON domains.id=data_bases.dom_id WHERE data_bases.name='username'"