[root@AY130828161048465847Z ~]# vi mysqlbak.sh 
#!/bin/bash

USERNAME=root
PASSWORD=mysql
DBNAME=test

DATE=`date +%Y%m%d`

MYSQLDUMP=/usr/bin/mysqldump

BACKDIR=/data/bak

${MYSQLDUMP} -u${USERNAME} -p${PASSWORD} ${DBNAME} | gzip > ${BACKDIR}/${DBNAME}.${DATE}.sql.gz

posted on 2014-11-05 09:02  馒头斋  阅读(110)  评论(0编辑  收藏  举报