How to backup/restore a Plesk database dump ?

Share it:


Automatic Plesk database dumps are stored in the directory defined by the DUMP_D variable value in the /etc/psa/psa.conf file

Plesk for Linux:

Automatic Plesk database dumps are stored in the directory defined by the DUMP_D variable value in the /etc/psa/psa.conf file.

There are two types of automatic dumps:

Daily dumps that are made every night, together with running of the statistics utility. Dump files have names like mysql.daily.dump.1.gz and each file includes a dump of three databases:

psa
horde
mysql

Pre-upgrade dumps that are made when the Plesk package update is run. Dump file names look like mysql.preupgrade.<version and time stamp>.dump.gz , and each file includes a dump of:

mysql
psa
apsc

If you want to perform a database backup manually, use the command below:

for Plesk 11.5 and newer:

# plesk db dump DATABASE_NAME > FILE_NAME.sql

for Plesk 11 and older:

# MYSQL_PWD=`cat /etc/psa/.psa.shadow` mysqldump -u admin DATABASE_NAME > FILE_NAME.sql

The example below shows how to restore ' PSA ' database from the dump:

# plesk db psa < psa.sql


The following example shows how to restore ' PSA ' database from the pre-upgrade backup file:

# MYSQL_PWD=`cat /etc/psa/.psa.shadow` mysql -u admin -e"DROP DATABASE psa;"
# zcat /var/lib/psa/dumps/mysql.preupgrade.<version and time stamp>.dump.gz | sed -n '/-- Current Database: `psa`/,/-- Current Database:*/p' | MYSQL_PWD=`cat /etc/psa/.psa.shadow` mysql -f -uadmin
If you need to restore all of these three databases, you have to delete them before restoration using the DROP DATABASE SQL command.



Plesk for Windows:

Automatic Plesk database dumps are stored in the "%plesk_dir%"\\Mysql\\Backup directory.

If you want to perform a database backup manually, use the command below (run Windows command prompt as Administrator):

"%plesk_dir%"\\Mysql\\bin\\mysqldump.exe -uadmin -p<plesk_admin_password> -P8306 DATABASE_NAME > FILE_NAME.sql
Since Plesk 12.5 the shortcut command is available for backup creation:

plesk db dump DATABASE_NAME > FILE_NAME.sql
The following example shows how to restore the "%plesk_dir%"\\MySQL\\Backup\\psa-20131202194200.sql backup file:

"%plesk_dir%"\\Mysql\\bin\\mysql.exe -uadmin -p<plesk_admin_password> -P8306 psa < "%plesk_dir%"\\Mysql\\Backup\\psa-20131207194200.sql
Share it:

Post A Comment:

0 comments: