Question
How to restore a user's database from a Plesk backup?
Answer
Note: To extract a dump of a user's database from a Plesk backup without restoration, follow the command-line instructions below.
-
Go to to Tools & Settings > Backup Manager (or Domains > example.com > Backup Manager if this is a subscription backup).
-
Click on a backup that contains a database you want to restore.
-
Select Type of object to restore as Database > select a subscription > select a database you want to restore.
-
Click Restore to begin the restoration.
Click on the picture to enlarge
-
Connect to a Plesk server via SSH.
-
Find the current backup location:
# grep "DUMP_D" /etc/psa/psa.conf
DUMP_D /var/lib/psa/dumps -
Find a database you want to restore with the path from step 2 and a database name using the command below. Replace example_db with an actual database name:
# find /var/lib/psa/dumps/ | grep example_db
The output will look like this:
# find /var/lib/psa/dumps/ | grep example_db
/var/lib/psa/dumps/clients/john_doe/domains/example.com/databases/example_db
/var/lib/psa/dumps/clients/john_doe/domains/example.com/databases/example_db/backup_xxxxxxxxx.tgz -
Extract the database to the
/root
directory with a full path to the database from step 3:# tar -xvf /var/lib/psa/dumps/clients/john_doe/domains/example.com/databases/example_db/backup_xxxxxxxxx.tgz -C /root/
-
To restore a database from this dump, run this command:
# MYSQL_PWD=`cat /etc/psa/.psa.shadow` mysql -uadmin db_example < /path/to/database_dump
where
- /path/to/database_dump - the extracted database dump from step 4
- db_example - the database in which the dump is going to be restored