Articles in this section

How to restore a user database from a Plesk backup

Plesk for Windows kb: how-to Plesk for Linux Ideal

Applicable to:

  • Plesk for Linux
  • Plesk for Windows

Question

How to restore a user database from a Plesk backup?

Answer

Note: To extract a dump of a user database from a Plesk backup without restoration, follow the command-line instructions below.

  1. Log in to Plesk.
  2. Go to to Tools & Settings > Backup Manager (or Domains > example.com > Backup Manager if this is a subscription backup).
  3. Click on a backup that contains a database you want to restore.
  4. Select Type of object to restore as Database > select a subscription > select a database you want to restore.
  5. Click Restore to begin the restoration.


    Restoring a database
     

 

Restoring a database from a Plesk backup via a command-line interface
  1. Connect to a Plesk server via SSH.
  2. Find the current backup location:

    # grep "DUMP_D" /etc/psa/psa.conf
    DUMP_D /var/lib/psa/dumps

  3. 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

  4. 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/

  5. 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

 

Was this article helpful?

Comments

1 comment
Date Votes
  • Thank you for this, Kuzma, very helpful!

    0

Please sign in to leave a comment.