mysql_config_editor 安全登录方式

Posted davie_2020

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了mysql_config_editor 安全登录方式相关的知识,希望对你有一定的参考价值。

 mysql_config_editor 安全登录方式

 

# 管理员用户

[root@db143 bak]# /usr/local/mysql/bin/mysql_config_editor set --login-path=instance_3306_root --host=localhost --user=root --port=3306 --password --socket=/data/mysql/mysql_3306/tmp/mysql_3306.sock 
Enter password: 
[root@db143 bak]#

 

 

# 备份用户

[root@db143 bak]# /usr/local/mysql/bin/mysql_config_editor set --login-path=instance_3306_bak --host=localhost --user=bak --port=3306 --password --socket=/data/mysql/mysql_3306/tmp/mysql_3306.sock
Enter password: 
[root@db143 bak]#

 

# 打印

[root@db143 bak]# /usr/local/mysql/bin/mysql_config_editor print --all
[instance_3306_bak]
user = bak
password = *****
host = localhost
socket = /data/mysql/mysql_3306/tmp/mysql_3306.sock
port = 3306
[instance_3306_root]
user = root
password = *****
host = localhost
socket = /data/mysql/mysql_3306/tmp/mysql_3306.sock
port = 3306
[root@db143 bak]#

# 帮助信息

[root@db145 ~]# /usr/local/mysql/bin/mysql_config_editor --help       
/usr/local/mysql/bin/mysql_config_editor  Ver 8.0.18 for linux-glibc2.12 on x86_64 (MySQL Community Server - GPL)
Copyright (c) 2012, 2019, 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.

MySQL Configuration Utility.
Usage: /usr/local/mysql/bin/mysql_config_editor [program options] [command [command options]]
  -#, --debug[=#]     This is a non-debug version. Catch this and exit.
  -?, --help          Display this help and exit.
  -v, --verbose       Write more information.
  -V, --version       Output version information and exit.

Variables (--variable-name=value)
and boolean options {FALSE|TRUE}  Value (after reading options)
--------------------------------- ----------------------------------------
verbose                           FALSE

Where command can be any one of the following :
       set [command options]     Sets user name/password/host name/socket/port
                                 for a given login path (section).
       remove [command options]  Remove a login path from the login file.
       print [command options]   Print all the options for a specified
                                 login path.
       reset [command options]   Deletes the contents of the login file.
       help                      Display this usage/help information.

[root@db145 ~]# 

# 示例

[root@db145 ~]# /usr/local/mysql/bin/mysql_config_editor print --help      
/usr/local/mysql/bin/mysql_config_editor  Ver 8.0.18 for linux-glibc2.12 on x86_64 (MySQL Community Server - GPL)
Copyright (c) 2012, 2019, 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.

MySQL Configuration Utility.

Description: Print the contents of login file in unencrypted form.
Usage: /usr/local/mysql/bin/mysql_config_editor [program options] [print [command options]]
  --all               Used with print command to print all login paths.
  -?, --help          Display this help and exit.
  -G, --login-path=name 
                      Name of the login path to use in the login file. (Default
                      : client)

Variables (--variable-name=value)
and boolean options {FALSE|TRUE}  Value (after reading options)
--------------------------------- ----------------------------------------
all                               FALSE
login-path                        client
[root@db145 ~]# /usr/local/mysql/bin/mysql_config_editor print --login-path=instance_3306_bak
[instance_3306_bak]
user = bak
password = *****
host = localhost
socket = /data/mysql/mysql_3306/tmp/mysql_3306.sock
port = 3306
[root@db145 ~]# 

以上是关于mysql_config_editor 安全登录方式的主要内容,如果未能解决你的问题,请参考以下文章

MySQL之mysql_config_editor使用

Mysql安全的小技巧

Mysql 5.6 新特性(转载)

mysql_config_editor usage

mysql_config_editor

mysql_config_editor设置