> 数据库 > MySQL >

MySQL备份脚本


#!/bin/sh
#本份数据库
#Local backup dir and backup bin setting
Local_Dir=/var/jfb/backup/mysql
Backup_Bin=/usr/bin/mysqldump

#Database setting
Db_Host=172.30.0.2
Db_Name=ec
Db_User=uu_db
Db_Pass=lok
Bak_File=$Db_Name`date +%Y-%m-%d-%H--%M`

#Begin to Backup
mkdir -p $Local_Dir
cd $Local_Dir
$Backup_Bin --force -q -h $Db_Host -u $Db_User -p$Db_Pass $Db_Name | gzip -c | cat >  $Bak_File.sql.gz




(责任编辑:IT)