#/bin/bash
DATE=`date +%Y-%m-%d`
MYSQL="mysql -uroot -h xxx "
for db in `$MYSQL -e "show databases"|sed ‘1d‘`; do
mkdir -p $db_$DATE
cd $db_$DATE
for table in `$MYSQL $db -e "show tables"|sed ‘1d‘`;do
mysqldump --opt $db $table |gzip >$db_$table.sql.gz
done
done