• mysql_config_editor的配置


    参考文档:
    https://mysql.net.cn/doc/refman/8.0/en/mysql-config-editor.html

    OS上分别有2套库,设置后,通过不使用密码来登录,类似postgres的.pgpass文件 

    -- 执行一下命令,会要求提示输入密码 

    1. mysql_config_editor set --login-path=3306 --user=root --host=127.0.0.1 --port=3306 --password
    2. mysql_config_editor set --login-path=3307 --user=root --host=127.0.0.1 --port=3307 --password

    -- 产生的.mylogin.cnf文件,这是一个隐藏文件 ,而且不是文本格式的,所以打开会是乱码

    1. [root@redhat762100 ~]# more .mylogin.cnf
    2. �ԋu����>���J

    --通过print打印出分组3306,分组3307,以及所有的内容 

    1. [root@redhat762100 ~]# mysql_config_editor print --login-path=3306
    2. [3306]
    3. user = root
    4. password = *****
    5. host = 127.0.0.1
    6. port = 3306
    7. [root@redhat762100 ~]# mysql_config_editor print --login-path=3307
    8. [3307]
    9. user = root
    10. password = *****
    11. host = 127.0.0.1
    12. port = 3307
    13. [root@redhat762100 ~]#
    14. [root@redhat762100 ~]# mysql_config_editor print --all
    15. [3306]
    16. user = root
    17. password = *****
    18. host = 127.0.0.1
    19. port = 3306
    20. [3307]
    21. user = root
    22. password = *****
    23. host = 127.0.0.1
    24. port = 3307
    25. [root@redhat762100 ~]#

    -- 通过免密码登录到3306库

    1. [root@redhat762100 ~]# mysql --login-path=3306
    2. Welcome to the MySQL monitor. Commands end with ; or \g.
    3. Your MySQL connection id is 30
    4. Server version: 5.7.25-log MySQL Community Server (GPL)
    5. Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
    6. Oracle is a registered trademark of Oracle Corporation and/or its
    7. affiliates. Other names may be trademarks of their respective
    8. owners.
    9. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
    10. root@db 15:27: [(none)]>

    -- 通过免密码登录到3307库 

    1. [root@redhat762100 ~]# mysql --login-path=3307
    2. Welcome to the MySQL monitor. Commands end with ; or \g.
    3. Your MySQL connection id is 12
    4. Server version: 5.7.25-log MySQL Community Server (GPL)
    5. Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
    6. Oracle is a registered trademark of Oracle Corporation and/or its
    7. affiliates. Other names may be trademarks of their respective
    8. owners.
    9. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
    10. root@db 15:27: [(none)]>

    END 

  • 相关阅读:
    Redis启动时提示Creating Server TCP listening socket *:6379: bind: No error
    整理一次python 编程遇到的报错(1)(c/s通信相关)
    ubuntun-20.04 安装 python3.8
    原型链污染攻击
    构建自己的插件框架:第 1 部分
    乐鑫的ESP32-S3芯片的LE能实现beacon功能吗?
    Docker中安装Jenkins
    计算机专业毕业设计项目推荐14-文档编辑平台(SpringBoot+Vue+Mysql)
    Go中GUI库fyne
    主动成为行业发展的一份子,正在成为一种潮流和趋势
  • 原文地址:https://blog.csdn.net/xxzhaobb/article/details/133581402