mysql自动备份Shell脚本,具体代码如下:
#!/bin/sh
#program:
# backup the mysql
#history:
#2013/08/17 yubinhong first release
read -p "请输入要备份数据库的个数:" n
for i in $(seq 1 $n)
do
read -p "请输入第$i个数据库:" database
time=$(date +%Y%m%d)
mysqldump -uroot -p123456 $database > $database$time.sql
done
echo "备份完成!"
更多信息请查看IT技术专栏