MYSQL database dumps through ssh
#!/bin/sh
PASS=$1
for i in `/usr/bin/mysql --user=root --password=$PASS --batch --skip-column-names -e "show databases" | sed 's/ /%/g'`;do
nice -n 19 /usr/bin/mysqldump -u root -p$PASS "$i" > /home/backupsql/"$i".sql
gzip /home/backupsql/"$i".sql
done
This will dump all databases into separate files, then gzip them. Perfect script for using in a backuppc DumpPreUserCmd option.
Comments
Post new comment