Backup all plesk MySQL Databases to individual files

Posted by Michael on Super User See other posts from Super User or by Michael
Published on 2013-10-21T17:24:14Z Indexed on 2013/10/21 21:56 UTC
Read the original article Hit count: 189

Filed under:
|
|
|
|

Hy,

Because I'm new to shell scripting I need a hand. I currently backup all mydatabases to a single file, thing that makes the restore preaty hard. The second problem that my MySQL password dosen't work because of a Plesk bug and i get the password from "/etc/psa/.psa.shadow". Here is the code that I use to backup all my databases to a single file.

mysqldump -uadmin -p`cat /etc/psa/.psa.shadow` --all-databases | bzip2 -c > /root/21.10.2013.sql.bz2

I found some scripts on the web that backup each database to individual files but I don't know how to make them work for my situation. Here is a example script:

for db in $(mysql -e 'show databases' -s --skip-column-names); do mysqldump $db | gzip > "/backups/mysqldump-$(hostname)-$db-$(date +%Y-%m-%d-%H.%M.%S).gz"; done

Can someone help me make the script above work for my situation? Requirements:

  1. Backup each database to individual file using plesk password location.

© Super User or respective owner

Related posts about linux

Related posts about bash