How to get the main/primary domain by using any domain/subdomain name of the subscription and all domains/subdomains under the subscription via MySQL query?

Follow

Comments

2 comments

  • Avatar
    John Bertin

    Neither of these commands work

  • Avatar
    Alexandr Redikultsev (Edited )

    Hi @John Bertin.

    I have just tested the commands and they seemed to work.

    I have main domain named example.com and several other domains under that subscription: example.org and sub.example.com. 

    I was able to get example.com with the first query:

    # plesk db "select name from domains where id=(select webspace_id from domains where name='example.org)";
    +-------------+
    | name        |
    +-------------+
    | example.com |
    +-------------+

    And both additional domains with this one:

    # plesk db "select name from domains where webspace_id=(select id from domains where name='example.com')";
    +------------------------+
    | name                   |
    +------------------------+
    | example.org            |
    | sub.example.com        |
    +------------------------+

    In case you want to catch some other information, please clarify it.

Please sign in to leave a comment.

Have more questions? Submit a request