首页 > 数据库 >mysql定时备份并删除30天前的备份

mysql定时备份并删除30天前的备份

时间:2023-01-17 10:57:07浏览次数:45  
标签:mysql backup 备份 30 天前 sql data

backup mysql data

riqi=$(date +%Y-%m-%d)

mysqldump -h50.100.13.2 -uroot -ptenx#cloud999 -P3306 -A --lock-tables=0 | gzip > /opt/mysql-data-backup/all-data-$riqi.sql.gz

clean old 30 *.sql file

find /opt/mysql-data-backup/ -maxdepth 1 -type f -mtime +30 -name "*.sql.gz" -exec rm -rf {} ;

标签:mysql,backup,备份,30,天前,sql,data
From: https://www.cnblogs.com/putaoo/p/17057245.html

相关文章