Article ID: 116917, created on Aug 24, 2013, last review on Jun 16, 2016

  • Applies to:
  • Plesk for Linux/Unix
  • Plesk 12.0 for Windows

Question

How to get list of domains and their IP addresses in one query?

Answer

Run the following command from command line:

# MYSQL_PWD=`cat /etc/psa/.psa.shadow` mysql -u admin -Dpsa -e"SELECT dom.id, dom.name, ia.ipAddressId, iad.ip_address FROM domains dom LEFT JOIN DomainServices d ON (dom.id = d.dom_id AND d.type = 'web') LEFT JOIN IpAddressesCollections ia ON ia.ipCollectionId = d.ipCollectionId LEFT JOIN IP_Addresses iad ON iad.id = ia.ipAddressId"

It will result output as below:

+----+-------------------------------+-------------+------------+
| id | name                          | ipAddressId | ip_address |
+----+-------------------------------+-------------+------------+
| 21 | domain1.tld                   |           1 | 10.0.0.1   |
| 36 | domain2.tld                   |           1 | 10.0.0.1   |
| 38 | domain3.tld                   |           2 | 10.0.0.2   |
| 26 | domain4.tld                   |           2 | 10.0.0.2   |
+------------------------------------+-------------+------------+

For Windows version see article #124159.

Search Words

list of domains with ip

subdomains

Database query

Some database entries related to Panel IP addresses are corrupted

domains

list of domains with ip

a914db3fdc7a53ddcfd1b2db8f5a1b9c 56797cefb1efc9130f7c48a7d1db0f0c 29d1e90fd304f01e6420fbe60f66f838 ed7be2b984f9c27de1d2dc349dc19c6d 85a92ca67f2200d36506862eaa6ed6b8 a766cea0c28e23e978fa78ef81918ab8

Email subscription for changes to this article
Save as PDF