Reply to comment

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.

Reply

  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.
  • Web page addresses and e-mail addresses turn into links automatically.

More information about formatting options


Check out Gangster Politics Montreal.