#!/bin/bash
#export MySql table and table's data
#table's name in single file,shell to read this file and read by line
#shell script by okhelper ,2016-02-26
cat $1 | while read LINE
do
CMD="mysqldump -h 127.0.0.1 -uroot -proot fsdb $LINE"
echo $CMD
#sleep 1
eval $CMD |tee $LINE.sql
#sleep 1
done
echo ""
echo "backup fsdb's table complet!"
#export MySql table and table's data
#table's name in single file,shell to read this file and read by line
#shell script by okhelper ,2016-02-26
cat $1 | while read LINE
do
CMD="mysqldump -h 127.0.0.1 -uroot -proot fsdb $LINE"
echo $CMD
#sleep 1
eval $CMD |tee $LINE.sql
#sleep 1
done
echo ""
echo "backup fsdb's table complet!"
本文介绍了一个使用bash脚本实现的MySQL数据库表级备份方法。通过读取文件中的表名并逐一导出,实现了对指定数据库中各表的独立备份。每张表的数据将被保存在一个单独的.sql文件中。
410

被折叠的 条评论
为什么被折叠?



