• 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 Moving a domain's locally stored database to an external server

Vane

New Pleskian
Hi.

All of the subscriptions on my Plesk have their databases stored locally, on the same server where Plesk is installed. Two or three of the domains (e-commerce stores) are generating quite a bit of traffic overall and I would like to move their databases to an external server. I've already set it up, it's up and running and added to Plesk as a secondary database server.

Here comes the issue though. I haven't found an option to move the existing domain's database to the external server. I could move it manually even, but still, there isn't an option in the Plesk interface to change the db server that the specific, already existing domain uses. Or is there?

I am able to use the external db server for new subscriptions without any issues.
How can I solve this problem?

Cheers
Peter
 
Hi Vane,

there is no such option in Plesk, but it is quite easy to backup the corresponding databases over the command line or over the Plesk Control Panel and import it on your external database - server.


Example:
  1. Database dump over the command line, creating a temporary download folder in your document - root of your domain before the dump:
    Code:
    mkdir -p /var/www/vhosts/YOUR-DOMAIN.COM/httpdocs/temp/backup
    
    plesk db dump DATABASE_NAME > /var/www/vhosts/uwefilthaut.de/httpdocs/temp/backup/DATABASE_NAME.sql
    Now pls. correct the folder and files permissions with for example:
    Code:
    chown -R YOUR-DOMAIN-ADMIN-NAME:psacln /var/www/vhosts/YOUR-DOMAIN.COM/httpdocs/temp
  2. Log in to your external server ( preferably as user "root" ), create a temporary download folder, get the database - dump from your main - server and import the dump to your current, external database.
    Code:
    mkdir -p /root/temp/backup
    
    cd /root/temp/backup
    
    wget http://YOUR-DOMAIN.COM/temp/backup/DATABASE_NAME.sql
    
    plesk db DATABASE_NAME < DATABASE_NAME.sql
  3. Delete the temporary folders and files on both servers, after your successfull import.
 
Dumping the database to another server is not my main concern. The thing is, I would like to force Plesk to stop using the locally stored database and start using the external database INSTEAD. As I've said before, with new subscriptions/domains I can just choose the database server from the dropdown list and it works just fine.

For already existing domains there's simply no option to switch db servers in Plesk UI, so I guess I have to do it manually somehow. But how?
 
You can try to change db_server_id in data_bases table for your dom_id.
db_server_id for your external DB server you can find in DatabaseServers table.
 
Back
Top