• 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 

  • 相关阅读:
    静态curl库编译与使用(c++)
    快速复现 实现 facenet-pytorch 人脸识别 windows上 使用cpu实现 人脸对比
    [Unity] IL2CPP编译VTable错误
    这款“三无产品“ 值得曝光...
    C语言—统计从键盘输入的一行英文句子的字符个数
    SpringCloud LoadBalancer 新一代负载均衡器
    谷歌广告投放需要避免的误区,如何防止谷歌广告账号关联?
    NoSQL - MongoDB 常见的shell操作 - 安装
    【笔者感悟】笔者的学习感悟【二】
    DJ9-2 中断方式
  • 原文地址:https://blog.csdn.net/xxzhaobb/article/details/133581402