mysql_config_editor

帮助信息请查看
man mysql_config_editor 或 mysql_config_editor -? 或 mysql_config_editor set -?
该工具会在用户家目录生成二进制文件:.mylogin.cnf
该文件格式由选项组组成,每个选项组被称为login path ,仅包含特定选项: host, user, password, port and socket 用于用户验证。
 

用法:

mysql_config_editor set [command options] Sets user name/password/host name/socket/port for a given login path (section). 
mysql_config_editor remove [command options] Remove a login path from the login file.
mysql_config_editor print [command options] Print all the options for a specified login path.
mysql_config_editor reset [command options] Deletes the contents of the login file.
 

设置 login path

[root@mysql1 ~]# mysql_config_editor set -?
-h, --host=name Host name to be entered into the login file.
-G, --login-path=name Name of the login path to use in the login file. (Default: client)
-p, --password Prompt for password to be entered into the login file.
-u, --user=name User name to be entered into the login file.
-S, --socket=name Socket path to be entered into login file.
-P, --port=name Port number to be entered into login file.
如:
mysql_config_editor set -G mypath -u root -p -S /u01/data/mysql5.7.25/mysql.sock
mysql_config_editor set -G user1 -u user1 -p -S /u01/data/mysql5.7.25/mysql.sock
 

显示 login path

mysql_config_editor print --all
mysql_config_editor print -G user1
[root@mysql1 ~]# mysql_config_editor print --all
[client] # 默认 login path
[mypath]
user = root
password = *****
socket = /u01/data/mysql5.7.25/mysql.sock
[mypath1]
user = root
password = *****
socket = /u01/data/mysql5.7.25/mysql.sock
[user1]
user = user1
password = *****
socket = /u01/data/mysql5.7.25/mysql.sock

删除 login path

mysql_config_editor remove -G user1
[root@mysql1 ~]# mysql_config_editor remove -G user1
[root@mysql1 ~]# mysql_config_editor print --all
[client]
[mypath]
user = root
password = *****
socket = /u01/data/mysql5.7.25/mysql.sock
[mypath1]
user = root
password = *****
socket = /u01/data/mysql5.7.25/mysql.sock

重置 login file

mysql_config_editor reset
[root@mysql1 ~]# mysql_config_editor reset
[root@mysql1 ~]# mysql_config_editor print --all # 文件已被清空

使用 login path

mysql --login-path=mypath
mysqladmin  --login-path=mypath
[root@mysql1 ~]# mysqladmin --login-path=mypath status
Uptime: Threads: Questions: Slow queries: Opens: Flush tables: Open tables: Queries per second avg: 0.001
 

Mysql 安全登陆工具 mysql_config_editor的更多相关文章

  1. MySQL初始化故障-----mysql_config_editor中的坑

    今天准备新启一个MySQL实例,结果竟然无法初始化,内容如下: -------------------------------------------------------------------- ...

  2. MySQL 通过mysql_config_editor更安全的登录数据库

    在5.6版本中,MySQL可以通过mysql_config_editor登录数据库,变得更加安全. [root@hank-yoon ~]# mysql_config_editor set --logi ...

  3. mysql之mysql_config_editor

    本文来自我的github pages博客http://galengao.github.io/ 即www.gaohuirong.cn mysql_config_editor允许你把登录的身份验证信息存储 ...

  4. mysql 主从复制以及binlog 测试

    ###mysql查看binlog日志内容 https://blog.csdn.net/nuli888/article/details/52106910 mysql的binlog日志位置可通过show ...

  5. Keepalived安装工具

    装keepalived前,要先检查主机上是否已经安装, ps -ef | grep keepalive 不检查的话.easy把前人装的东西覆盖掉,那么曾经弄的配置文件都没了比較麻烦. 下面都为root ...

  6. SUSE12SP3-Mysql5.7安装

    1.将以下安装包复制到服务器 mysql-community-client-5.7.24-1.sles12.x86_64.rpm mysql-community-server-5.7.24-1.sle ...

  7. 批量执行 sql 的 shell 脚本

    最近有用到需要批量导入N个表的sql,一个个导入会吐老血的,写了个shell脚本,便捷导入. 通常我们导入单个sql,可以用 $mysql -uroot -p world < xxxx.sql ...

  8. Linux如何查看YUM的安装目录

    Linux下如何查看使用YUM安装过的包的安装路径呢? 在搞清楚这个问题前,我们先来了解一下YUM. YUM(全称为 Yellow dog Updater, Modified)是一个在Fedora和R ...

  9. 查找yum 安装目录

    [root@DB-Server ~]# rpm -qa | grep -i mysql MySQL-server-advanced-5.6.20-1.rhel5 MySQL-client-advanc ...

随机推荐

  1. String path = request.getContextPath

    <% String path = request.getContextPath(); String basePath = request.getScheme()+"://"+ ...

  2. Oracle获取session的trace

    1. 使用参数SQL_TRACE 下面是官网对此参数的说明 SQL_TRACE Property Description Parameter type Boolean Default value fa ...

  3. java笔记--线程休眠sleep()的运用

    线程休眠sleep()方法的运用 在多线程编程中,有时需要让某个线程优先执行.除了可以设置这个线程的优先级为最高外,更加理想的方法是休眠其他线程,若有线程中断了正在休眠的线程,则抛出Interrupt ...

  4. Sql语法高级应用之三:存储过程

    一.存储过程概述 SQL Server中的存储过程是使用T_SQL编写的代码段.它的目的在于能够方便的从系统表中查询信息,或者完成与更新数据库表相关的管理任务和其他的系统管理任务.T_SQL语句是SQ ...

  5. 滑动cell的时候执行动画效果

    滑动cell的时候执行动画效果 效果图: 源码: // // ViewController.m // AniTab // // Created by XianMingYou on 15/2/26. / ...

  6. POST请求上传多张图片并携带参数

    POST请求上传多张图片并携带参数 在iOS中,用POST请求携带参数上传图片是非常恶心的事情,HTTPBody部分完全需要我们自己来配置,这个HTTPBody分为3个部分,头部分可以携带参数,中间部 ...

  7. 详细说明php的4中开源框架(TP,CI,Laravel,Yii)

    ThinkPHP简称TP,TP借鉴了Java思想,基于PHP5,充分利用了PHP5的特性,部署简单只需要一个入口文件,一起搞定,简单高效.中文文档齐全,入门超级简单.自带模板引擎,具有独特的数据验证和 ...

  8. ASP.NET MVC多语言 仿微软网站效果

    文章转载自:https://blog.csdn.net/cooldiok/article/details/78313513 微软作为ASP.NET的创造者,它对于官网的结构设计肯定有值得我们借鉴和参考 ...

  9. 破解myeclipse10失败的一个奇葩原因

    昨天开发用的myeclipse10突然弹窗提示我要激活,我清楚的记得安装时候已经破解并且看到激活信息了. 翻遍搜索出来的文章,改systemid之类的也试过了,问题依旧存在,很是绝望. 今早过来机灵了 ...

  10. setnx redis

    使用锁 1)setnx(lockkey, 当前时间+过期超时时间) ,如果返回1,则获取锁成功:如果返回0则没有获取到锁,转向2.2.)get(lockkey)获取值oldExpireTime ,并将 ...