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

本文涉及的产品
云数据库 RDS MySQL,集群系列 2核4GB
推荐场景:
搭建个人博客
RDS MySQL Serverless 基础系列,0.5-2RCU 50GB
云数据库 RDS PostgreSQL,集群系列 2核4GB
简介:

               

关于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

相关实践学习
如何在云端创建MySQL数据库
开始实验后,系统会自动创建一台自建MySQL的 源数据库 ECS 实例和一台 目标数据库 RDS。
全面了解阿里云能为你做什么
阿里云在全球各地部署高效节能的绿色数据中心,利用清洁计算为万物互联的新世界提供源源不断的能源动力,目前开服的区域包括中国(华北、华东、华南、香港)、新加坡、美国(美东、美西)、欧洲、中东、澳大利亚、日本。目前阿里云的产品涵盖弹性计算、数据库、存储与CDN、分析与搜索、云通信、网络、管理与监控、应用服务、互联网中间件、移动服务、视频服务等。通过本课程,来了解阿里云能够为你的业务带来哪些帮助     相关的阿里云产品:云服务器ECS 云服务器 ECS(Elastic Compute Service)是一种弹性可伸缩的计算服务,助您降低 IT 成本,提升运维效率,使您更专注于核心业务创新。产品详情: https://www.aliyun.com/product/ecs
相关文章
|
2月前
|
Python
解决安装ConcurrentLogHandler报错error in ConcurrentLogHandler setup command: use_2to3 is invalid.
本文介绍了在Python环境下安装ConcurrentLogHandler时遇到的"use_2to3 is invalid"错误的解决方法,主要是通过降级setuptools到57.5.0版本来解决该问题。
109 2
|
4月前
|
关系型数据库 MySQL 数据安全/隐私保护
已解决:mysql: [Warning] Using a password on the command line interface can be insecure.
已解决:mysql: [Warning] Using a password on the command line interface can be insecure.
277 0
|
5月前
|
开发工具
inappropriate address 127.0.0.1 for the fudge command, line ignored 时间同步的时候报错
inappropriate address 127.0.0.1 for the fudge command, line ignored 时间同步的时候报错
222 10
|
网络虚拟化
ValueError: check_hostname requires server_hostname的解决办法
报错ValueError: check_hostname requires server_hostname通常是因为版本冲突等原因,查遍网上众多大佬总结的经验后,最终发现是由网络代理导致的问题,即我们通常说的vpn问题。
246 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.
|
Linux
七个办法只有一个有效:200 PORT command successful. Consider using PASV.425 Failed to establish connection.
七个办法只有一个有效:200 PORT command successful. Consider using PASV.425 Failed to establish connection.
543 0
七个办法只有一个有效:200 PORT command successful. Consider using PASV.425 Failed to establish connection.
autoreconf: command not found
autoreconf: command not found
401 0
g++: command not found
g++: command not found
73 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)
736 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是一个字符,导致运行错误。
1329 0
下一篇
无影云桌面