美文网首页
03.`Ubuntu18.04`下`mysql`设置`root`

03.`Ubuntu18.04`下`mysql`设置`root`

作者: 风安峻_ | 来源:发表于2020-07-28 00:22 被阅读0次
  1. mysql5.7默认无密码登录

    默认root用户无密码登录
  2. 数据库mysql中的user表的plugin字段为auth_socket

    # 查看所有的数据库
    show databases;
    
    # 使用名为 mysql 的数据库
    use mysql;
    
    # 查看 Host,User,plugin,authentication_string
    # authentication_string 对应加密之后的密码
    select Host,User,plugin,authentication_string from user;
    
    查看 plugin
  3. 修改密码

    • update user set authentication_string=PASSWORD('password'),plugin='mysql_native_password' where User='root' and Host='localhost';
      • 设置本机的root用户的密码为password以及使用密码登录
    设置密码以及密码登录
  4. 刷新

    • FLUSH PRIVILEGES;
    刷新
  5. 重新登录

    重新登录

相关文章

网友评论

      本文标题:03.`Ubuntu18.04`下`mysql`设置`root`

      本文链接:https://www.haomeiwen.com/subject/lrdxrktx.html