首页 > 代码库 > mysqldump提示Warning: Using a password on the command line interface can be insecure.

mysqldump提示Warning: Using a password on the command line interface can be insecure.

场景:

主机A和主机B在局域网内,之前一直在主机A上用计划任务在跑mysqldump去备份主机B上的数据库,前两天突然出现:Warning: Using a password on the command line interface can be insecure.


之前的计划任务的代码是:

mysqldump -h10.255.xxx.xxx  -uroot -pxxxx dbxxx | gzip > /root/Db/Backup/DbName_$(date +\%Y\%m\%d-\%H).sql.gz

然后直接在主机A上执行,会提示Warning: Using a password on the command line interface can be insecure. 并且备份不成功。


然后把代码改为:

mysqldump -uroot -pxxxx -h 10.255.xxx.xxx dbxxx | gzip > /root/Db/Backup/DbName_$(date +\%Y\%m\%d-\%H).sql.gz (就是把-h的参数放在后面)

再执行,依然会提示Warning: Using a password on the command line interface can be insecure.但是可以备份成功。



mysqldump提示Warning: Using a password on the command line interface can be insecure.