Cannot add a new domain or migrate existing one: DNS record already exists

Refers to:

  • Plesk

Created:

2016-11-16 12:50:12 UTC

Modified:

2017-02-08 16:41:16 UTC

3

Was this article helpful?


Have more questions?

Submit a request

Cannot add a new domain or migrate existing one: DNS record already exists

Symptoms

An attempt to create a new domain or migrate existing one fails and the following error is shown:

DNS records for domain with such name already exist

or

The subdomain with such name already exists

or

This DNS record already exists

Cause

A DNS record for the domain already exists in Plesk database, so a new domain with the same name cannot be added.

Resolution

Try finding a record with similar name in the DNS settings of the existing domains.

  1. Open Plesk database:

    Linux:

    # MYSQL_PWD=`cat /etc/psa/.psa.shadow` mysql -u admin psa

    Windows:

    Refer to this article: #3472 [How To] How to access Plesk database

  2. Run the following query to find the DNS record preventing the new domain creation (replace "example.com." with the real name of the domain you are trying to create)

    Note: Pay attention to the "." symbol at the end of domain name.

    Linux:

    mysql> select z.name, r.host, r.type, r.val from dns_zone z, dns_recs r where  z.id=r.dns_zone_id and r.host like '%example.com%';

    or

    mysql> select * from dns_zone where displayname like '%example.com%'\\G
    mysql> delete from dns_zone where id=<domain_id>;
    mysql> delete from dns_recs where host like '%example.com%';

    Windows:

    For MSSQL and MySQL DB provider:

    mysql> select z.name, r.host, r.type, r.val from dns_zone z, dns_recs r where  z.id=r.dns_zone_id and r.host like '%example.com%';

    For MS Access DB provider:

    mysql> select z.name, r.host, r.type, r.val from dns_zone z, dns_recs r where  z.id=r.dns_zone_id and r.host like '%example.com%';

    Example:

You try creating a domain called support.example.com , but the above error appears. The above shell command returns the following output:

    mysql> select z.name, r.host, r.type, r.val from dns_zone z, dns_recs r where z.id=r.dns_zone_id and r.host like '%support.example.com%';

+-------------+-----------------------+------+----------------+
| name | host | type | val |
+-------------+-----------------------+------+----------------+
| mydomain.com| support.mydomain.com. | A | 192.168.45.200 |
+-------------+-----------------------+------+----------------+

Open the corresponding domain ( mydomain.com in the example above) in the Plesk web interface and examine its DNS zone for records containing the name of the domain you tried adding. If you want to create the support.example.tld domain as a separate domain in Plesk, the existing record with a similar name has to be removed from the mydomain.com DNS zone.

Another possible cause:

A DNS record may exist in the dns_recs table, but have no Plesk domain associated with it. This may be because of a failed domain removal in the past. You can remove such records directly from the dns_recs table using the following query:.

Note: back up the psa database before modifying it.

Linux:

    mysql> DELETE FROM `dns_recs` WHERE DisplayHost LIKE '%support.example.com%';

Windows:

For MSSQL and MySQL DB provider:

    mysql> DELETE FROM `dns_recs` WHERE DisplayHost LIKE '%support.example.com%';

For MS Access DB provider:

    DELETE FROM `dns_recs` WHERE DisplayHost LIKE '%support.example.com%';
Have more questions? Submit a request
Please sign in to leave a comment.