zoukankan      html  css  js  c++  java
  • MySQL Other--mysql_config_editor学习使用

    mysql_config_editor工具

    为避免MySQL明文密码出现在脚本或命令中,从MySQL5.6开始提供了mysql_config_editor工具,可以将数据库连接信息进行加密并保存到用户根目录下的.mylogin.cnf文件中。

    创建登录信息:

    /export/servers/mysql/bin/mysql_config_editor 
    set --login-path="local_login_path" 
    --host="127.0.0.1" --port=3306 
    --user="root" --password

    查看登录信息:

    /export/servers/mysql/bin/mysql_config_editor print --login-path=local_login_path

    [local_login_path]
    user = root
    password = *****
    host = 127.0.0.1
    port = 3306

    登录密码已经被加密

    删除登录信息:

    /export/servers/mysql/bin/mysql_config_editor remove --login-path=local_login_path

    重置所有登录信息:

    /export/servers/mysql/bin/mysql_config_editor reset

    创建快速登录命令

    ## 创建快速登录脚本并授予执行权限
    
    echo "
    /export/servers/mysql/bin/mysql --login-path=local_login_path --no-auto-rehash
    " >/usr/local/bin/mysql_login
    
    chmod +x /usr/local/bin/mysql_login

    执行上面脚本后,退出重登录,就可以直接使用mysql_login登录本地数据库,不用担心账号密码泄露。

  • 相关阅读:
    React Children 使用
    Redux 中间件和异步操作
    Redux 核心概念
    React 的setState 异步理解
    JS 中类型和类型转换
    ES6 新增集合----- Set 和Map
    ES6 新增基本数据类型Symbol
    ES6 解构赋值
    ES6 对象增强
    ES6 中的let 和 const
  • 原文地址:https://www.cnblogs.com/gaogao67/p/11662877.html
Copyright © 2011-2022 走看看