在linux服务器使用脚本自动数据库时,报如下错误,备份不成功,求问大神如何解决:
Warning: Using a password on the command line interface can be insecure
以下是我的脚本:
#!/bin/sh
DUMP=/usr/local/mysql/bin/mysqldump
OUT_DIR=/home/dbbak/today
OUT_HISTORY_DIR=/home/dbbak/oldday
DB_NAME=yjs
DB_USER=root
DB_PASS=root
DATE=date +%Y%m%d-%H%M%S
echo $DATE
cd $OUT_DIR
OUT_SQL="$DATE.sql"
$DUMP -u$DB_USER -p$DB_PASS $DB_NAME --default-character-set=utf8 --opt -Q -R --skip-lock-tables > $OUT_SQL
find $OUT_DIR -name "*.sql" -type f -mtime +0 -exec mv {} $OUT_HISTORY_DIR \;
find $OUT_HISTORY_DIR -name "*.sql" -type f -mtime +3 -exec rm {} \;