Skip to content

Instantly share code, notes, and snippets.

@edfuh
Created July 25, 2011 18:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save edfuh/1104785 to your computer and use it in GitHub Desktop.
Save edfuh/1104785 to your computer and use it in GitHub Desktop.
saving this here because I always lose it
#!/bin/sh
echo "MySQL User:";
read MYSQLUSER;
echo "MySQL Pass:";
read MYSQLPASS;
for I in $(mysql -h localhost -u $MYSQLUSER --password=$MYSQLPASS -e 'show databases' -s --skip-column-names);
do mysqldump -u $MYSQLUSER -h localhost --password=$MYSQLPASS $I | gzip > "$I.sql.gz";
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment