mysql警告
在进行命令行查看数据的实话,使用mysql -uxxx -pxxx -Pxxx
的时候,会有如下警告
1
| Warning: Using a password on the command line interface can be insecure
|
报错原因是mysql 5.6
版本增加了密码安全策略,不过上一篇zabbix监控mysql的文章做了处理,但是如果服务器被入侵了那你的数据库也就暴露了,所以这里换一种方式 使用--login-path
mysql配置
1
| mysql_config_editor set --login-path=local --host=localhost --user=zabbix -p
|
--login-path
是设置访问的名字,我设置的local
--host
是指定允许访问的host
地址,这个地址是你grant
的时候配置的
--user
是用户名,也是grant
时候配置的
-p
是指定密码,同样是grant
配置
使用下面命令查看
1 2 3 4 5
| $ mysql_config_editor print --all [local] user = zabbix password = ***** host = localhost
|
访问测试
1 2 3 4 5 6 7 8 9 10 11 12 13 14
| $ mysql --login-path=local Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 9217 Server version: 5.6.35-log MySQL Community Server (GPL) Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. MySQL [(none)]>
|
上一篇:zabbix监控tcp状态
下一篇:zabbix监控mysql