mysql自動備份Shell腳本,具體代碼如下:
#!/bin/sh
#program:
# backup the mysql
#history:
#2013/08/17 yubinhong first release
read -p "請輸入要備份數(shù)據(jù)庫的個數(shù):" n
for i in $(seq 1 $n)
do
read -p "請輸入第$i個數(shù)據(jù)庫:" database
time=$(date +%Y%m%d)
mysqldump -uroot -p123456 $database > $database$time.sql
done
echo "備份完成!"
更多信息請查看IT技術(shù)專欄