1. 有时候客户端连接mysql需要指定密码时(如用zabbix监控mysql5.6后数据库会给出个警告信息
  2. mysql -uroot -pxxxx
  3. Warning: Using a password on the command line interface can be insecure.
  4.  
  5. 但是在zabbix里监控就不好取值了,除了在my.cnf中加入,但这样需要重启数据库而且也暴露了数据库密码
  6. [mysqladmin]
  7. user=zabbix
  8. password=xxxxxx
  9. [mysql]
  10. user=zabbix
  11. password=xxxxxx
  12.  
  13. 使用mysql_config_editor可以实现将密码保存在一个配置中,下次登录不用输入用户名密码
  14. login-pathMySQL5.6开始支持的新特性。通过借助mysql_config_editor工具将登陆MySQL服务的认证信息加密保存在.mylogin.cnf文件(默认位于用户主目录) 。之后,MySQL客户端工具可通过读取该加密文件连接MySQL,避免重复输入登录信息,避免敏感信息暴露
  15.  
  16. mysql_config_editor set --login-path=local --host=localhost --user=root --password
  17. Enter password: (输入密码)
  18.  
  19. login-path=name 在登录文件中为login path添加名字
  20. host=name 添加host到登陆文件中
  21. password 在登陆文件中添加密码(该密码会被mysql_config_editor自动加密)
  22. user 添加用户名到登陆文件中
  23. port=name 添加登陆端口到登陆文件中
  24. socket=name 添加sock文件路径到登陆文件中
  25.  
  26. 显示配置:
  27. mysql_config_editor print --login-path=test #显示执行的login-path配置
  28. mysql_config_editor print --all #显示所有的login-path信息
  29.  
  30. [root@localhost ~]# mysql_config_editor print --all
  31. [local]
  32. user = root
  33. password = *****
  34. host = localhost
  35.  
  36. 删除配置:
  37. mysql_config_editor remove --login-path=test
  38.  
  39. 使用login-path登录:
  40. [root@localhost ~]# mysql --login-path=local
  41. Warning: Using unique option prefix sock instead of socket is deprecated and will be removed in a future release. Please use the full name instead.
  42. Welcome to the MySQL monitor. Commands end with ; or \g.
  43. Your MySQL connection id is 13
  44. Server version: 5.6.32-78.1-log Source distribution
  45.  
  46. Copyright (c) 2009-2016 Percona LLC and/or its affiliates
  47. Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
  48.  
  49. Oracle is a registered trademark of Oracle Corporation and/or its
  50. affiliates. Other names may be trademarks of their respective
  51. owners.
  52.  
  53. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
  54.  
  55. [root@localhost][(none)]>

解决mysql连接输入密码提示Warning: Using a password on the command line interface can be insecure的更多相关文章

  1. zabbix 3.4监控mysql,提示mysql: [Warning] Using a password on the command line interface can be insecure.

    mysql从5.6版本开始,如果是命令行直接出现了数据库连接密码就会有以下警告: mysql: [Warning] Using a password on the command line inter ...

  2. mysql: "Warning: Using a password on the command line interface can be insecure." 解决方法

    错误重现: 命令行或者shell脚本中执行以下命令,如果您当前服务器mysql版本是大于5.6的,则会出现警告:Warning: Using a password on the command lin ...

  3. 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 MySQL 5.6 警告信息 comma ...

  4. MySQL 5.6 Warning: Using a password on the command line interface can be insecure

    MySQL 5.6 在命令行输入密码,就会提示这些安全警告信息. Warning: Using a password on the command line interface can be inse ...

  5. 消除Warning: Using a password on the command line interface can be insecure的提示

    最近在部署Zabbix时需要用脚本取得一些MySQL的返回参数,需要是numberic格式的,但是调用脚本时总是输出这一句: Warning: Using a password on the comm ...

  6. MYSQL报警:Warning: Using a password on the command line interface can be insecure.

    问题描述:执行下面的语句,sql是执行成功了,但是出现了一个报警,报警看上去始终不舒服 mysql -hip -Pport -uuser -ppassword -e "use db;dele ...

  7. mysql 备份报错mysqldump: [Warning] Using a password on the command line interface can be insecure.

    -------------------------------------------------------------------------------- mysql 备份报错mysqldump ...

  8. 【mysql报错】MySQL5.7.27报错“[Warning] Using a password on the command line interface can be insecure.”

    MySQL5.7.27报错“[Warning] Using a password on the command line interface can be insecure.”在命令行使用密码不安全警 ...

  9. mysql备份时过滤掉某些库 以及 去掉"Warning: Using a password on the command line interface can be insecure."提示信息

    在对mysql进行完整备份时使用--all-database参数 # mysqldump -u root -h localhost -p --all-database > /root/all.s ...

随机推荐

  1. Python短小精悍的Orator基本使用技巧

    基本使用 配置 设置数据库配置参数,创建一个DatabaseManager实例. from orator import DatabaseManager config = { 'mysql': { 'd ...

  2. hdu1063

    #include<iostream> #include<string> using namespace std; struct BigReal //高精度实数 { int le ...

  3. [CentOS7] at, bash, cron, anacron

    声明:本文主要总结自:鸟哥的Linux私房菜-第十五章.例行性工作排程(crontab),如有侵权,请通知博主 at => /var/spool/at /etc/at.allow, /etc/a ...

  4. java笔试面试题准备

    J2SE基础 九种基本数据类型的大小,以及它们的封装类 byte 8 Byte char 16 Character short 16 Short int 32 Integer long 64 Long ...

  5. Ubuntu系统配置的一些要点

    硬盘安装时必须先卸载光驱! 安装时如果是uefi,应该把引导驱动器设为windows所在的硬盘,否则设为整个硬盘..然后就可以用easybcd来设置windows下的引导. unity tweak t ...

  6. CF986A Fair

    题目描述 Some company is going to hold a fair in Byteland. There are n n n towns in Byteland and m m m t ...

  7. TOPOI 测验1320, 问题C: 4410: [CF41D]Pawn 解题报告

    题目链接 题目大意 在一个树阵中按一定走法取一些树,使和最大且被 k+1整除 解题思路 类似一个数塔问题 因为最后的结果要被 k+1 整除,所以可以记录到每一个点  对 k+1 取余结果不同的最优解( ...

  8. 再谈布局,栅栏式自适应布局的学习和实现(calc自适应布局)

    布局真的很重要.一个不好的布局后期会有很多很多的bug,就像是建房子的地基一样. 首先,再一次地圣杯布局的学习,来源于该教程: http://www.jianshu.com/p/f9bcddb0e8b ...

  9. iOS客户端与网页交互文档

    很少和客户端打交道,这次由于做会活动,要和客户端配合做个分享的功能 这里总结下基本的流程,就是前端在H5 里调用客户端的方法即可 第一部分 客户端提供需求文档 网页请求设置 客户端发起请求时在HTTP ...

  10. Linux命令发送Http的get或post请求(curl和wget两种方法)

    Http请求指的是客户端向服务器的请求消息,Http请求主要分为get或post两种,在Linux系统下可以用curl和wget命令来模拟Http的请求.下面就来介绍一下Linux系统如何模拟Http ...