Created
April 18, 2015 01:21
-
-
Save wtser/33ca633aaf4b7f03c569 to your computer and use it in GitHub Desktop.
mysql 数据恢复 Shell 脚本
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
function restore(){ | |
cd /var/tmp/ | |
tar zxvf sql.tar.gz | |
for databaseName in $* | |
do | |
sqlFileName=""$databaseName".sql" | |
echo "importing "$databaseName | |
# 导入数据库 | |
mysql -uuser -ppassword $databaseName < sql/$sqlFileName | |
done | |
echo '数据备份完成' | |
} | |
restore 'site1.cn' 'site2.com' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment