Search Engine: Elastic

Article ID: 128839, created on May 16, 2016, last review on May 16, 2016

  • Applies to:
  • Plesk Automation 11.5


  1. I have created a new resource type MySQL custom and replaced default MySQL database resource with it in my service template.

  2. The MySQL custom resource has provisioning attribute MySQL custom attribute, the same attribute assigned to the newly added MySQL Service Node with IP address

  3. When new webspace is created the MySQL database service is provisioned to the new server, but when trying to create new database on a webspace created with old MySQL resource MySQL database it still trying to create database on the old MySQL Service Node with IP

How to update existing webspace so it starts using new database server?


Apply the following command to an existing webspace:

# /usr/local/psa/bin/subscription_settings -u domain.tld -default_server_mysql

Where domain.tld is the webspace name and is the new MySQL server.

In order to update default DB server for batch of webspaces from particular service node you can run following commands:

  1. Get list of subscription with Web hosting from old Service Node mysql1.domain.tld:

    # mysql -uadmin -p`cat /etc/psa/.psa.shadow` psa -Ne "SELECT FROM domains AS domains  INNER JOIN DomainServices AS DomainServices ON = DomainServices.dom_id  INNER JOIN IpAddressesCollections AS IpAddressesCollections ON IpAddressesCollections.ipCollectionId = DomainServices.ipCollectionId AND \"web\" = DomainServices.type  INNER JOIN IP_Addresses AS IP_Addresses ON IpAddressesCollections.ipAddressId =  WHERE (IP_Addresses.ip_address='') and (domains.webspace_id = 0);" > /root/webspaces_from_linux2.txt

    Here is - IP address of service node. Results will be saved in /root/webspaces_from_linux2.txt file.

  2. Update default MySQL database server using simple script like:

    # for w in `cat /root/webspaces_from_linux2.txt`; do /usr/local/psa/bin/subscription_settings -u $w -default_server_mysql; done

    Here is - IP address of required (new) DB server.

NOTE: existing MySQL databases will not be transferred to new Database Server.

33a70544d00d562bbc5b17762c4ed2b3 caea8340e2d186a540518d08602aa065 e0aff7830fa22f92062ee4db78133079

Email subscription for changes to this article
Save as PDF