- Plesk for Windows
- Plesk for Linux
An attempt to delete an IP address from Plesk fails with the following error:
Error: The IP address `<ip_address>` is already used for hosting.
However, in Tools & Settings > IP Addresses , no sites are shown to use this IP address.
This is caused by a Plesk database inconsistency. The
table was not correctly updated when IP addresses were changed for domains.
Create a backup of
"%plesk_dir%\\MySQL\\bin\\mysqldump.exe" -uadmin -P8306 -p<PleskPasswordHere> psa > c:\\psadump.sql
mysqldump -uadmin -p`cat /etc/psa/.psa.shadow ` psa > /tmp/psa.`date +%F_%H.%M`.sql
Find out which "
id" is assigned to the IP address in question, and find any (sub)domains that have this IP address assiged:
mysql> select @ip_id := id from IP_Addresses where ip_address='10.10.10.10';
mysql> SELECT d.name, d.webspace_id, ipac.ipCollectionId,ds.type,ip.ip_address FROM DomainServices ds INNER JOIN IpAddressesCollections ipac ON ds.ipCollectionId = ipac.ipCollectionId INNER JOIN domains d ON d.id = ds.dom_id JOIN IP_Addresses ip on ipac.ipaddressid=ip.id WHERE (ds.type = 'web' OR ds.type = 'mail') and ipac.ipAddressId = @ip_id;
Make sure the
10.10.10.10IP address is replaced with the one to be deleted.
Find records in the
IpAddressesCollectionstable that correspond to the IP address in question:
mysql> select * from IpAddressesCollections where ipaddressid=@ip_id;
Find out which
idis assigned to the IP address that should be used for the (sub)domains from the previous output, then update the corresponding records of the
For example, the
10.10.10.11IP address should be assigned to
mysql> set @domain_name := 'example.com';
mysql> select @ip_id_new := id from IP_Addresses where ip_address='10.10.10.11';
mysql> update IpAddressesCollections ipac INNER JOIN DomainServices ds ON ds.ipCollectionId = ipac.ipCollectionId INNER JOIN domains d ON d.id = ds.dom_id JOIN IP_Addresses ip on ipac.ipaddressid=ip.id set ipac.ipAddressId=@ip_id_new WHERE (ds.type = 'web' OR ds.type = 'mail') and ipac.ipAddressId = @ip_id and d.name=@domain_name;