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

本文涉及的产品
云数据库 RDS MySQL Serverless,0.5-2RCU 50GB
简介:

               

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



spacer.gif

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

wKiom1jbmLXh8BKvAAAVgSRHPCs528.png

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

 

1
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上执行这条命令结果为:

wKiom1jbmgrw1_MKAAAEddd19lo073.png

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

原来这种情况在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:

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


2.Then you can use in your shell script:

1
mysql --login-path= local  -e  "statement"


instead of:

1
mysql -u username -p pass -e  "statement"


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



本文转自 青苗飞扬 51CTO博客,原文链接:http://blog.51cto.com/qingmiao/1911535

相关实践学习
基于CentOS快速搭建LAMP环境
本教程介绍如何搭建LAMP环境,其中LAMP分别代表Linux、Apache、MySQL和PHP。
全面了解阿里云能为你做什么
阿里云在全球各地部署高效节能的绿色数据中心,利用清洁计算为万物互联的新世界提供源源不断的能源动力,目前开服的区域包括中国(华北、华东、华南、香港)、新加坡、美国(美东、美西)、欧洲、中东、澳大利亚、日本。目前阿里云的产品涵盖弹性计算、数据库、存储与CDN、分析与搜索、云通信、网络、管理与监控、应用服务、互联网中间件、移动服务、视频服务等。通过本课程,来了解阿里云能够为你的业务带来哪些帮助     相关的阿里云产品:云服务器ECS 云服务器 ECS(Elastic Compute Service)是一种弹性可伸缩的计算服务,助您降低 IT 成本,提升运维效率,使您更专注于核心业务创新。产品详情: https://www.aliyun.com/product/ecs
相关文章
|
11月前
|
网络虚拟化
ValueError: check_hostname requires server_hostname的解决办法
报错ValueError: check_hostname requires server_hostname通常是因为版本冲突等原因,查遍网上众多大佬总结的经验后,最终发现是由网络代理导致的问题,即我们通常说的vpn问题。
196 0
|
安全 关系型数据库 MySQL
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.
mysqldump: [Warning] Using a password on the command line interface can be insecure.
autoreconf: command not found
autoreconf: command not found
326 0
g++: command not found
g++: command not found
51 0
|
网络安全 开发工具
【解决方案】A session ended very soon after starting. Check that the command in profile “XXX” is correct.
【解决方案】A session ended very soon after starting. Check that the command in profile “XXX” is correct.
782 0
【解决方案】A session ended very soon after starting. Check that the command in profile “XXX” is correct.
|
Java Android开发
is not allowed for source level below 1.7 的解决办法
is not allowed for source level below 1.7 的解决办法
126 0
|
XML 分布式计算 Hadoop
hiveserver2连接报错: User: root is not allowed to impersonate anonymous (state=08S01,code=0)
hiveserver2连接报错: User: root is not allowed to impersonate anonymous (state=08S01,code=0)
630 0
|
移动开发 Linux Shell
$‘\r‘: command not found的解决方法
在Linux系统中,运行Shell脚本,出现了如下错误: one-more.sh: line 1: $'\r': command not found 1 出现这样的错误,是因为Shell脚本在Windows系统编写时,每行结尾是\r\n,而在Linux系统中行每行结尾是\n,所以在Linux系统中运行脚本时,会认为\r是一个字符,导致运行错误。
1224 0