Applicable to:
- Plesk for Linux
- Plesk for Windows
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
Comments
4 comments
Is there a way to do the same for files?
Hello Sharul Hafiz
Check this instruction: https://support.plesk.com/hc/en-us/articles/213906705
I have full backup and a number of incremental backups and none of them actually restore any data from the databases.
This is literally not working. All databases show 0 tables and 0 bytes of data.
Backup done in Plesk Onyx 17.8.11 Update #53 (Ubuntu 14.04.6 LTS), trying to restore in Plesk Obsidian 18.0.30 Update #2 (CentOS Linux 7.8.2003 (Core)).
This is with web GUI. Will try manually from the backup and update you.
[...]
Later at 13:32
OK, so in the console it works when I do it manually, but only after I increase the max_allowed_packet limit following these instructions:
https://support.plesk.com/hc/en-us/articles/213414749
However, even after increasing this, Plesk web gui still does not restore anything...
[...]
Later at 13:48
OK, I figured the rest out :)
So, the problem was exactly as described here:
https://support.plesk.com/hc/en-us/articles/115001135353-Unable-to-migrate-a-database-Unknown-collation-utf8-unicode-520-ci-
The solution of updating MariaDB to version 10.2 worked for me, too:
https://support.plesk.com/hc/en-us/articles/213403429
Hello Rad Paluszak
Glad to hear that it was finally sorted out.
Please sign in to leave a comment.