export PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:$USER/bin:/usr/local/mysql/bin

prog=`basename $0`

MYSQL="mysql"

MYSQLDUMP="mysqldump"

IgnoreDB='information_schema|#mysql50|lost\+found|performance_schema|test|mysql'

DB=`$MYSQL -ua -pa -ss -e "SHOW DATABASES;"| egrep -v ${IgnoreDB}`

Backup ()

{

for bakdb in ${DB}

do

file="${bakdb}.sql"

$MYSQLDUMP -uroot -pa --add-drop-database=FALSE --add-drop-table=FALSE -d "$bakdb" > /tmp/schema/${file}

done

}

[[ -d /tmp/schema ]] || mkdir /tmp/schema

Backup