Bobcares

How to Backup or Restore a System Database in Plesk

PDF Header PDF Footer

Easily back up or restore system databases in Plesk for Linux and Windows. Take a minute and discover what our Plesk Support Team has to say.

Backup or Restore a System Database in Plesk

Backup and restoration processes play a key role in ensuring data integrity, safeguarding against accidental loss, and facilitating disaster recovery. In fact, Plesk provides multiple methods to back up and restore databases, ranging from exporting SQL dumps to recovering entire subscriptions.

Database Backup Methods

Backup or Restore a System Database in PleskDatabases can be backed up in the following ways:

  1. Exporting a Database Dump (SQL Format)

    A database dump in SQL format enables the creation and download of the database as a single file. This dump can be restored into the same or another database. This method is useful for creating portable backups or migrating data.

  2. Backing Up an Entire Subscription

    An entire subscription backup allows storing the data on the Plesk server or a remote FTP server. During restoration, an individual database can be selected for recovery.

  3. Cloud Backup Solutions

    Plesk integrates with several cloud services for off-site storage. For example, you can backup to Cloud Pro in Plesk to store your backups securely offsite.

For AWS users, you can also configure Plesk S3 backups to send your database backups directly to Amazon S3, ensuring data redundancy and accessibility.

Database Restoration Methods

Databases can be restored from either a subscription backup archive or an SQL dump file:

  1. Importing a Database Dump

    This method restores data from an SQL file into any database of the same type (e.g., MySQL or MariaDB).

  2. Restoring from a Subscription Backup

    When restoring from a subscription backup, the specific database to be recovered can be selected.

Backup & Restore Commands in Plesk for Linux

  • Creating a Database Dump
    plesk db dump database_name > /path/to/dump_name.sql

    Example:

    Creates a dump of the `psa` database in `/root` with today’s date:


    plesk db dump psa > /root/psa_dump.sql
    ls /root/psa_dump.sql
  • Restoring a Database from a Dump
    plesk db < /path/to/dump_name.sql

    Example:

    Restores the `psa` database from `/root/psa_dump.sql`:

    plesk db < /root/psa_dump.sql

Backup & Restore Commands in Plesk for Windows Server

  • Creating a Database Dump
    plesk db dump database_name > C:\path\to\dump_name.sql

    Example:

    Creates a dump of the `psa` database:

    plesk db dump psa > C:\psa_dump.sql
  • Restoring a Database from a Dump
    plesk db < C:\path\to\dump_name.sql

    Example:

    Restores `psa` from `C:\psa_dump.sql`:

    plesk db < C:\psa_dump.sql

Restoring System Databases from Plesk Daily or Pre-Upgrade Dumps

On Linux

  1. From Daily Dumps:

    Go to daily dump storage:


    cd /var/lib/psa/dumps
    ls -l mysql.daily*

    Also, to restore a single system database:

    zcat mysql.daily.dump.0.gz | sed -n '/-- Current Database: `psa`/,/-- Current Database:*/p' | plesk db

    We can restore a single table with this command:

    zcat mysql.daily.dump.0.gz | sed -n '/-- Table structure for table `log_actions`/,/-- Table*/p' | plesk db

    To restore all system databases:

    zcat mysql.daily.dump.0.gz | plesk db
  2. From Pre-Upgrade Dumps:
    cd /var/lib/psa/dumps
    ls -l mysql.preupgrade*
    zcat mysql.preupgrade..dump.gz | MYSQL_PWD=`cat /etc/psa/.psa.shadow` mysql -uadmin

On Windows Server

From Daily Dumps:

Go to backup directory:

cd %plesk_dir%MysqlBackup
dir /O:-D

Also, to restore the latest dump:

plesk db < psa-YYYYMMDDHHMMSS.sql

[Need assistance with a different issue? Our team is available 24/7.]

Conclusion

Regular database backups are essential for operational stability and business continuity. With Plesk’s built-in tools, backups are stored securely and restoration is streamlined in case of data corruption, accidental deletion, or system failure.

In brief, our Support Experts demonstrated how to back up or restore system databases in Plesk for Linux and Windows.

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

Get featured on the Bobcares blog and share your expertise with a global tech audience.

WRITE FOR US

GET UP TO 25% OFF

Plesk Support

Spend time on your business, not on your servers.

Managing a server is time consuming. Whether you are an expert or a newbie, that is time you could use to focus on your product or service. Leave your server management & end-user tech support to us, and use that time to focus on the growth and success of your business.

TALK TO USOr click here to learn more.

Speed issues driving customers away?
We’ve got your back!