Question
How to add an existing database to Plesk from a remote MySQL/MariaDB server to a subscription?
Answer
-
Connect to the remote MySQL server over SSH
-
Create a dump of the required database on remote MySQL/MariaDB server:
# mysqldump -u<username> -p<password> db_name > /root/db_name_backup.sql
where:
db_name - database name
<username> - user name for remote MySQL/MariaDB server
<password> - password for remote MySQL/MariaDB server -
Download database dump file from remote MySQL/MariaDB server to your local computer:
To download the file to a computer with Windows use WinSCP
To download the file to a computer with Linux use command line
SCP
tool:# scp [email protected]:/root/db /home/johndoe/
where
203.0.113.2 - IP address of remote MySQL/MariaDB -
Log in to Plesk UI and create an empty database with a name that does not exist on the external server:
Navigate to Subscriptions > example.com > Databases > Add Database (choose external database server) .
-
Import backup file
db_name_backup.sql
created on step 2 to the database created on step 4:Navigate to Subscriptions > example.com > Databases > db_name2 > Import Dump > select file with database dump and press OK
where:
db_name2 - is the name of the database created in step 4.