mysqldump-1045

mysqldump: [Warning] Using a password on the command line interface can be insecure.
mysqldump: Got error: 1045: Access denied for user 'root'@'localhost' (using password: YES) when trying to connect

 

bakdb code

 

bakdir=/data/dbbak/
mkdir $bakdir -p
bakfilename=`date '+%y%m%d'`.sql.gz

dest=$bakdir/$bakfilename
mysqldump -uroot -p xxx  | gzip > $dest
sleep 5

echo "qrsctl put abc123 $bakfilename $dest "
qrsctl put abc123 $bakfilename $dest

 

dbbak.sh 

#! /usr/bin/expect

set timeout 10
set password  yourpassword 
spawn ~/bakdb
expect "Enter password:"
send "$password\r"
expect eof

 

 

/root/dbbak.sh   >> /var/log/dbbak.log

posted on 2018-06-20 09:34  iokde.com  阅读(193)  评论(0编辑  收藏  举报

导航