Skip to content

Instantly share code, notes, and snippets.

@wtser
Created April 18, 2015 01:21
Show Gist options
  • Save wtser/33ca633aaf4b7f03c569 to your computer and use it in GitHub Desktop.
Save wtser/33ca633aaf4b7f03c569 to your computer and use it in GitHub Desktop.
mysql 数据恢复 Shell 脚本
#!/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