MySQL Dump Script

Nicht schön aber funktinoniert!

#!/bin/bash

BPATH=/root/sqldump/
DATE=$(date +'%Y%m%d-%HH%MM')
MySQLPW=HEREDASMYSQLDBPW
DBs=`mysql -s -r --user="root" --password="$MySQLPW" -e "SELECT Db from mysql.db"`
echo $DBs

mkdir $BPATH/$DATE
for i in ${DBs[@]}
do
mysqldump --user="root" --password="$MySQLPW" $i > $BPATH/$DATE/$i.sql
done

cd $BPATH
tar czf $DATE.tar.gz $DATE/