Linux下自动备份MySQL
程序员文章站
2023-01-28 17:39:18
MySQL自动备份 #!/bin/sh# File: /alidata/server/mysql/backup_shell/backup.sh# Database infoDB_NAME="数据库名"DB_USER="用户名"DB_PASS="密码" # Others varsBIN_DIR="/a ......
mysql自动备份
#!/bin/sh
# file: /alidata/server/mysql/backup_shell/backup.sh
# database info
db_name="数据库名"
db_user="用户名"
db_pass="密码"
# others vars
bin_dir="/alidata/server/mysql/bin"
bck_dir="/备份到的目录"
date=`date +%f`
# todo
$bin_dir/mysqldump --opt -u$db_user -p$db_pass $db_name | gzip > $bck_dir/db_$date.gz