首页 > 代码库 > MYSQL 导出多个库
MYSQL 导出多个库
root@Debian:~# cat dumphelp.sh
DATABASES_TO_EXCLUDE="test"
EXCLUSION_LIST="‘information_schema‘,‘mysql‘"
for DB in `echo "${DATABASES_TO_EXCLUDE}"`
do
EXCLUSION_LIST="${EXCLUSION_LIST},‘${DB}‘"
done
SQLSTMT="SELECT schema_name FROM information_schema.schemata"
SQLSTMT="${SQLSTMT} WHERE schema_name NOT IN (${EXCLUSION_LIST})"
MYSQLDUMP_DATABASES="--databases"
for DB in `mysql -uroot -ANe"${SQLSTMT}"`
do
MYSQLDUMP_DATABASES="${MYSQLDUMP_DATABASES} ${DB}"
done
MYSQLDUMP_OPTIONS="--single-transaction --skip-opt --create-options --master-data=http://www.mamicode.com/2 -q -uroot --default-character-set=utf8"
mysqldump ${MYSQLDUMP_OPTIONS} ${MYSQLDUMP_DATABASES} > MySQLDatabases.sql
本文出自 “漫漫长路” 博客,请务必保留此出处http://ithelp.blog.51cto.com/4501237/1433683