MySQL数据备份脚本

#!/bin/bash
db_user="username"
db_passwd="password"
db_name="tableName"
# the directory for story your backup file.you shall change this dir
backup_dir="/opt/data/backup/"
# date format for backup file (dd-mm-yyyy)
time="$(date +"%Y%m%d%H%M%S")"
mysqldump -u$db_user  -p$db_passwd $db_name  > "$backup_dir/$db_name"_"$time.sql"

你可能感兴趣的:(MySQL数据备份脚本)