You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
dsMin/dsBackup/Shell/BackupMysqlFullDataBase.sh

14 lines
432 B

#!/bin/bash
location="/home/dsMin/Backup"
# 创建一个备份目录
mkdir -p $location
# 备份一个SQL类型的
date_str=`date +%Y%m%d%H%M%S`
mysqldump -h localhost -P 22066 -u root --password=DsideaL147258369 -R -E -e --max_allowed_packet=1048576 --net_buffer_length=16384 shl_db | gzip > $location/shl_db_$date_str.sql.gz
# 删除原文件(删除超过7天的)
#rm -rf ${FILE}
find $location -mtime +7 -type d |xargs rm -rf