How can I restore Plesk database dump?

Resolution

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

Automatic dumps consist of two types:

1) daily dumps which are made every night together with `statistics` utility run, dump files have names like mysql.daily.dump.1.gz

2) pre-upgrade dumps which are made during Plesk package update run, that are named like mysql.preupgrade.dump.gz.1

If you wish to perform the database backup manually, it can be done with the command like below:

# mysqldump -uadmin -p`cat /etc/psa/.psa.shadow` DATABASE_NAME > FILE_NAME.sql

The following example shows how to restore the mysql.preupgrade.dump.gz backup file.

# gunzip /var/lib/psa/dumps/mysql.preupgrade.dump.gz
mysql -uadmin -p`cat /etc/psa/.psa.shadow` -e"DROP DATABASE psa;"
mysql -f -uadmin -p`cat /etc/psa/.psa.shadow` < /var/lib/psa/dumps/mysql.preupgrade.dump

Actually, a standard daily backup file includes dump of three databases:

  • psa
  • horde
  • mysql

That is why the following error message may appear when you perform the latest command:

ERROR 1050 at line 3165: Table ‘horde_categories’ already exists

It happens because only ‘psa’ database is needed to be restored. If you need to restore all these three databases, then you have to delete them before restoration using “DROP DATABASE” sql command.

http://kb.parallels.com/en/881

Leave a comment