zabbix 3.4监控mysql,提示mysql: [Warning] Using a password on the command line interface can be insecure.

mysql从5.6版本开始,如果是命令行直接出现了数据库连接密码就会有以下警告:

  mysql: [Warning] Using a password on the command line interface can be insecure.

如用mysql -uroot -proot -e 'show varibles;'或echo “show full processlist "|mysql -uroot -p`cat /root/passwd`;在返回查询的结果中的第一行都有mysql: [Warning] Using a password on the command line interface can be insecure.

  如何去掉这行报警呢!其它很简单,我们弄清了它是怎么出现的就好解决了,你可以试着用管道只显示最后一行。如mysql -uroot -proot -e 'show varibles‘ | tail -n1  但好像不起作用,为什么呢!因为它是标准错误输出。加上 2>/dev/null 就可以了。

  mysql -uroot -proot -e 'show varibles’ 2>/dev/nul

原文地址:https://www.cnblogs.com/alex-hrg/p/8651556.html