• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

Question Bulk DNS Recorde change.

telo

New Pleskian
Server operating system version
debian
Plesk version and microupdate number
Obsidian Version 18.0.45
Hello


Can I also use this explanation for other DNS record changes. I need to change MX and NS records all over the server but don't want to use the template feature. (Had a problem last time.) Does a command like this work.

for MX Record:
plesk db "update dns_recs set val='newmx.domain.com', displayVal='newmx.domain.com' where type='MX' and displayVal='oldmx.domain.com';"

and
plesk repair dns -y

for NS Record:
plesk db "update dns_recs set val='newns.domain.com', displayVal='newns.domain.com' where type='NS' and displayVal='oldns.domain.com';"

and

plesk repair dns -y

work that or not ?

with IP works i know.
plesk db "update dns_recs set val='203.0.113.3', displayVal='203.0.113.3' where type='A' and displayVal='203.0.113.2';"

thank you
 
You can also use the command line:

i.e., to add a MX-record for each domain:
Code:
for domain in $(plesk db -Ne 'SELECT name FROM domains WHERE parentDomainId=0;'); do plesk bin dns -a $domain -mx mail -mailexchanger mail.example.com -priority 10; done

 
Last edited:
You can also use the command line:

i.e. to add an mx-records for each domain:
Code:
for domain in $(plesk db -Ne 'SELECT name FROM domains WHERE parentDomainId=0;'); do plesk bin dns -a $domain -mx mail -mailexchanger mail.example.com -priority 10; done

OK thanks. Is that also possible for all domains. I want to change this MX for all domains that contain the MX. (search replace ) Same as above. Does my idea above work? or not.
 
thank you. you wrote for all domain. Sorry I read wrong. is there also a command for replace i wanted to ask
 
Hi,

As far as I know, there is no replace command. You can first add the new MX record and next, delete the old MX record.
 
Hi,

As far as I know, there is no replace command. You can first add the new MX record and next, delete the old MX record.
I also had this idea, the problem is that if a domain already has an MX which is not the one I want to replace, this domain would have two MX records when I added it and this would then be wrong. So I need a replacement. Do you know if my idea in the first post would work? this

plesk db "update dns_recs set val='newmx.domain.com', displayVal='newmx.domain.com' where type='MX' and displayVal='oldmx.domain.com';"

and
plesk repair dns -y
 
I prefer using the command line utilities instead of directly updating records in the database. But you can give it a try. Just make sure to make a backup of the Plesk database in case something goes wrong:
Code:
plesk db dump psa > /root/psa_dump.sql
 
I prefer using the command line utilities instead of directly updating records in the database. But you can give it a try. Just make sure to make a backup of the Plesk database in case something goes wrong:
Code:
plesk db dump psa > /root/psa_dump.sql
ok thank you
 
Back
Top