mysql 导出数据库 数据表

* dump.sh

#!/usr/bin/env bash
DUMP="/opt/lampp/bin/mysqldump"
CONN="-uroot -h10.0.0.134 --databases easy_eyes -pXXXXXX"

${DUMP} ${CONN} > easy_eyes.sql

tables=(config admin rules users warn)
# for ((i = 0; i < ${#tables[@]}; i++)) do echo ${tables[i]}; done
for tbl in ${tables[@]}; do
    ${DUMP} ${CONN} --tables ${tbl} > "easy_eyes.${tbl}.sql"
done

* test

bash dump.sh

猜你喜欢

转载自blog.csdn.net/fareast_mzh/article/details/82994012