zoukankan      html  css  js  c++  java
  • MySQL使用普通用户访问返回ERROR 1698 (28000): Access denied for user 'root'@'localhost'

    这个问题最开始查资料都说要改密码,密码不对。其实不是这个样子都。

    解决方法

    1. 修改/etc/mysql/my.cnf,添加以下内容
      [mysqld]
      skip-grant-tables
      
    2. 重启mysql服务/etc/init.d/mysql restart
    3. 使用mysql -u root连接
    4. 执行select user, plugin from mysql.user;
      若显示以下结果,请继续;若没有,这篇文章解决不了。
    +------------------+-----------------------+
    | user             | plugin                |
    +------------------+-----------------------+
    | root             | auth_socket           |
    +------------------+-----------------------+
    
    1. 执行update mysql.user set authentication_string=PASSWORD('pass'),plugin='mysql_native_password' where user='root';将root都密码修改为pass
    2. 执行flush privileges;刷新一下
    3. 移除第一步添加的内容;重复第二步

    修改过后user表就变这样了

    +------------------+-----------------------+
    | user             | plugin                |
    +------------------+-----------------------+
    | root             | mysql_native_password |
    +------------------+-----------------------+
    
  • 相关阅读:
    期末作业验收
    SDN第五次上机作业
    个人作业——软件工程实践总结作业
    SDN第四次作业
    SDN第四次上机作业
    SDN第三次作业
    SDN第三次上机作业
    SDN第二次上机作业
    SDN第二次作业
    个人作业——软件产品案例分析
  • 原文地址:https://www.cnblogs.com/zhuxiaoxi/p/9903167.html
Copyright © 2011-2022 走看看