阿里云-云小站(无限量代金券发放中)
【腾讯云】云服务器、云数据库、COS、CDN、短信等热卖云产品特惠抢购

Warning: Using a password on the command line interface can be insecure.解决办法

152次阅读
没有评论

共计 788 个字符,预计需要花费 2 分钟才能阅读完成。

关于 MySQL 中 Warning: Using a password on the command line interface can be insecure. 解决办法

此问题在 zabbix 监控 mysql 的时候出现:

Warning: Using a password on the command line interface can be insecure. 解决办法

zabbix 调用脚本对 mysql 进行监控,脚本如下:

result=`/usr/local/mysql/bin/mysqladmin -u$MYSQL_USER -h$MYSQL_HOST -p${MYSQL_PWD} -S $MYSQL_SOCK extended-status |grep -w “Com_select”|cut -d”|” -f3`

很明显,这是因为 zabbix 获取到的值并不是想要的数值类型,而是文本类型,才有上面报错信息。

在 agent 上执行这条命令结果为:

Warning: Using a password on the command line interface can be insecure. 解决办法

有一条警告信息,意思是说你在命令行里输入密码是不安全的。

原来这种情况在 mysql5.6.X 版本中才会出现,解决方法如下:

1.If your MySQL client/server version is a 5.6.x a way to avoid the WARNING message are using the mysql_config_editor tools:

mysql_config_editor set –login-path=local –host=localhost –user=username –password

2.Then you can use in your shell script:

mysql –login-path=local -e “statement”

instead of:

mysql -u username -p pass -e “statement”

这样设置之后,在脚本里也全部写成这个样子,重启 agent 后,zabbix web 页面就正常了。

本文永久更新链接地址 :http://www.linuxidc.com/Linux/2017-06/144755.htm

正文完
星哥说事-微信公众号
post-qrcode
 
星锅
版权声明:本站原创文章,由 星锅 2022-01-22发表,共计788字。
转载说明:除特殊说明外本站文章皆由CC-4.0协议发布,转载请注明出处。
【腾讯云】推广者专属福利,新客户无门槛领取总价值高达2860元代金券,每种代金券限量500张,先到先得。
阿里云-最新活动爆款每日限量供应
评论(没有评论)
验证码
【腾讯云】云服务器、云数据库、COS、CDN、短信等云产品特惠热卖中