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/dsTools/Shell/BackupMysqlFullDataBase.sh

12 lines
433 B

#!/bin/bash
location="/usr/local/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 base_db | gzip > $location/base_db_$date_str.sql.gz
# 删除原文件(删除超过30天的)
#rm -rf ${FILE}
find $location -mtime +30 -type d |xargs rm -rf