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

本文涉及的产品
云数据库 RDS MySQL,集群系列 2核4GB
推荐场景:
搭建个人博客
RDS MySQL Serverless 基础系列,0.5-2RCU 50GB
RDS MySQL Serverless 高可用系列,价值2615元额度,1个月
简介:

               

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

相关实践学习
如何快速连接云数据库RDS MySQL
本场景介绍如何通过阿里云数据管理服务DMS快速连接云数据库RDS MySQL,然后进行数据表的CRUD操作。
全面了解阿里云能为你做什么
阿里云在全球各地部署高效节能的绿色数据中心,利用清洁计算为万物互联的新世界提供源源不断的能源动力,目前开服的区域包括中国(华北、华东、华南、香港)、新加坡、美国(美东、美西)、欧洲、中东、澳大利亚、日本。目前阿里云的产品涵盖弹性计算、数据库、存储与CDN、分析与搜索、云通信、网络、管理与监控、应用服务、互联网中间件、移动服务、视频服务等。通过本课程,来了解阿里云能够为你的业务带来哪些帮助     相关的阿里云产品:云服务器ECS 云服务器 ECS(Elastic Compute Service)是一种弹性可伸缩的计算服务,助您降低 IT 成本,提升运维效率,使您更专注于核心业务创新。产品详情: https://www.aliyun.com/product/ecs
相关文章
|
关系型数据库 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. 来自TMySQL用户,包括很多开发和GCS系统,都习惯mysql –u$USER –p$PASSWD 来执行,这条命令在MySQL 5.
2644 0
|
存储 SQL 调度
Warning: Using a password on the command line interface can be insecure.
<p><span style="color:#3366ff">做全备份不要使用名文,在命令行</span></p> <p>[root@t2 ~]# mysqldump -uroot -pjsb --lock-all-tables --master-data=2 --events --routines --all-databases &gt; /tmp/database_`date +%F
4111 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.
|
9月前
|
关系型数据库 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.
674 0
|
SQL 关系型数据库 数据安全/隐私保护
|
C++
解决“configure: line 2747: -g: command not found”
下面这个错误是因为没有安装g++ $ ./configure --prefix=/data1/mooon/run checking for a BSD-compatible install.
1050 0
|
安全 关系型数据库 Unix
Please read “Security” section of the manual to find out how to run mysqld as root!错误解决(转)
2016-03-12T15:40:45.717762Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2935 0
|
网络安全 数据安全/隐私保护