服务器数据库自动化备份
操作系统: CentOS 7.7 64位
mysql Ver 14.14 Distrib 5.7.28, for Linux (x86_64) using EditLine wrapper
通过crontab实现mysql数据的自动备份
创建启动脚本:
cd /etc/cron.daily/
touch mysqlTimingBackup
vi /etc/cron.daily/mysqlTimingBackup
编写脚本:
#!/bin/bash
#定义变量name的值,/bin/date日期格式为Y年-m月-d日
name=`/bin/date "+%Y-%m-%d"`
#/usr/bin/mysqldump 备份数据库的命令路径
#-u r