Skip to content

Instantly share code, notes, and snippets.

@peb7268
Created April 22, 2013 20:27
Show Gist options
  • Save peb7268/5438243 to your computer and use it in GitHub Desktop.
Save peb7268/5438243 to your computer and use it in GitHub Desktop.
bash: mysql auto dump
NOW=$(date '+%m_%d_%Y_%s')
DBS=`cat /bu/dbs.out`
#DBS="$(mysql -u root -h localhost -ppassword -Bse 'show databases')"
for db in $DBS
do
FILE=${db}_${NOW}.gz
OLDFILE=${db}_*.gz
#rm -f /bu/$OLDFILE
mysqldump -u root -h localhost -pronky $db | /bin/gzip -9 > /bu/$FILE
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment