Last active
January 13, 2016 13:22
-
-
Save ferstar/387b20c9468979ddd5f6 to your computer and use it in GitHub Desktop.
scripts about mysql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Name:bakmysql.sh | |
# This is a ShellScript For Auto DB Backup and Delete old Backup | |
# | |
backupdir=/home/sqlbak | |
mysql_bin_dir=/usr/bin | |
time=`date +%Y%m%d` | |
dbname1= | |
dbname2= | |
username= | |
passwd= | |
host= | |
$mysql_bin_dir/mysqldump -u $username -p$passwd -h $host $dbname1 | gzip > $backupdir/bak-$dbname1-$time.sql.gz | |
$mysql_bin_dir/mysqldump -u $username -p$passwd -h $host $dbname2 | gzip > $backupdir/bak-$dbname2-$time.sql.gz | |
find $backupdir -name "*.gz" -type f -mtime +7 -exec rm {} \; > /dev/null 2>&1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
数据库迁移
WordPress配置部分"wp-config.php"