码农知识堂 - 1000bd
  •   Python
  •   PHP
  •   JS/TS
  •   JAVA
  •   C/C++
  •   C#
  •   GO
  •   Kotlin
  •   Swift
  • 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 

  • 相关阅读:
    csdn月入过万的作者是如何练成的?
    JSP SSM 成果展示系统myeclipse开发mysql数据库springMVC模式java编程计算机网页设计
    Apache DolphinScheduler如何完全设置东八区?
    ubuntu samba文件共享服务器搭建
    Arduino应用开发——通过小爱同学控制灯光
    VS Code打开新的文件夹,会覆盖原来的文件夹。如何保持原来的文件夹并新打开一个窗口
    16数据结构与算法刷题之【滑动窗口】篇
    Power BI 傻瓜入门 8. 制作数据模型
    PointNeXt:通过改进的模型训练和缩放策略审视PointNet++
    2023年9月到2024年1月计划安排
  • 原文地址:https://blog.csdn.net/xxzhaobb/article/details/133581402
  • 最新文章
  • 攻防演习之三天拿下官网站群
    数据安全治理学习——前期安全规划和安全管理体系建设
    企业安全 | 企业内一次钓鱼演练准备过程
    内网渗透测试 | Kerberos协议及其部分攻击手法
    0day的产生 | 不懂代码的"代码审计"
    安装scrcpy-client模块av模块异常,环境问题解决方案
    leetcode hot100【LeetCode 279. 完全平方数】java实现
    OpenWrt下安装Mosquitto
    AnatoMask论文汇总
    【AI日记】24.11.01 LangChain、openai api和github copilot
  • 热门文章
  • 十款代码表白小特效 一个比一个浪漫 赶紧收藏起来吧!!!
    奉劝各位学弟学妹们,该打造你的技术影响力了!
    五年了,我在 CSDN 的两个一百万。
    Java俄罗斯方块,老程序员花了一个周末,连接中学年代!
    面试官都震惊,你这网络基础可以啊!
    你真的会用百度吗?我不信 — 那些不为人知的搜索引擎语法
    心情不好的时候,用 Python 画棵樱花树送给自己吧
    通宵一晚做出来的一款类似CS的第一人称射击游戏Demo!原来做游戏也不是很难,连憨憨学妹都学会了!
    13 万字 C 语言从入门到精通保姆级教程2021 年版
    10行代码集2000张美女图,Python爬虫120例,再上征途
Copyright © 2022 侵权请联系2656653265@qq.com    京ICP备2022015340号-1
正则表达式工具 cron表达式工具 密码生成工具

京公网安备 11010502049817号