On October 19, 2021, we have enabled single-sign-on for our Plesk Support Center to provide a seamless login/account experience. This implies that you’ll be able to use a single account across any of our web-facing properties.
If you had already registered your account at Plesk 360 (formerly known as My Plesk) please use one for login. Otherwise please re-register it using the same email address as your existing Zendesk login (support account). It’s essential that you use the same email address on our support center to ensure that your tickets stay attached to the same account.

How to list databases with their subscription/domain/owner using a MySQL query in Plesk

Follow

Comments

8 comments

  • Avatar
    Sreehari

    Can we have similar Query for MSSQL to list the DBs and their subscription/domain/owner

    0
    Comment actions Permalink
  • Avatar
    Vladimir Chernikov

    Hello @Sreehari,

    The data is gathered from the Plesk database. According to Plesk system requirements only MySQL is used for Plesk database.

    To filter MSSQL databases from Plesk database you may use the following Mysql query:
    select db.name as "Database",d.name as "Subscription",c.pname as "Owner",c.login as "Customer Username",db.type as "Server type" from data_bases db,domains d,clients c where d.cl_id=c.id and db.dom_id=d.id and db.type = 'mssql';

    0
    Comment actions Permalink
  • Avatar
    Sreehari

    Thanks Vladimir,

    I am able to figure out the MSSQL DBs by using the above query from MYSQL.

    0
    Comment actions Permalink
  • Avatar
    Gsamarguliani

    Is there a way to select database users as well ?

    0
    Comment actions Permalink
  • Avatar
    Julian Bonpland Mignaquy

    Gsamarguliani yes you proceed as follows:

    plesk db "select db.name as 'Database',d.name as 'Subscription',c.pname as 'Owner',e.login as 'Databa User', c.login as 'Customer Username' from data_bases db,domains d,clients c, db_users e where d.cl_id=c.id and db.dom_id=d.id and e.db_id=db.id"

    1
    Comment actions Permalink
  • Avatar
    Gsamarguliani (Edited )

    @Julian Bonpland Mignaquy thanks this works, how do i get plesk database user/password that is responsible for system databases ?

    i mean db,domains , db_users etc.

    0
    Comment actions Permalink
  • Avatar
    Maxim Krasikov

    Hello @Gsamarguliani,

    Due to security reasons, only hashes of passwords are stored in Plesk database.
    System user passwords cannot be viewed in plain text.

    If it is necessary, passwords can be updated in Plesk: https://support.plesk.com/hc/en-us/articles/360000277114

    0
    Comment actions Permalink
  • Avatar
    Pdiotis

    Hi,
    great query. However, we have several MSSQL servers for our customer's DBs. How can we get the same info per DB server so we can distinguish which databases are on which server?

    Best regards,

    Panos

    0
    Comment actions Permalink

Please sign in to leave a comment.

Have more questions? Submit a request