备份数据库

#!/bin/bash

bak_file_name=`date +%f`
bak_dir='/mysqlbak'
user='root'
pwd='123456'

dbname=''

[ -e $bakdir ] || mkdir $bakdir

mysqldump -u$user -p$pwd --flush-logs $dbname > $bakdir/bak_file_name-$dbname.sql

 

posted @ 2019-03-03 19:17  Ray_chen  阅读(141)  评论(0编辑  收藏  举报