mysql 定时备分脚本

No Comments Linux ,

#!/bin/sh

# Database info
DB_USER=”root”
DB_PASS=” “
DB_HOST=” “
DB_NAME=”–all-databases”
DB_PORT=”3308″
DB_UNAME=”XXX_3308″

BIN_DIR=”/usr/bin”           

BCK_DIR=”/opt/dbbackup”  

DATE=`date +%F`

$BIN_DIR/mysqldump –opt -u$DB_USER -p$DB_PASS -h$DB_HOST -P$DB_PORT $DB_NAME > $BCK_DIR/$DB_UNAME”_”$DATE.sql

发表评论