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 |
    +------------------+-----------------------+
    
  • 相关阅读:
    HierarchicalDataTemplate
    Prism技巧
    常用Exception
    netcore URL重新路径
    Nintendo Switch相册整理
    交换变量-不借助任何变量
    QCombobox样式stylesheet总结
    Qt新旧Moc方式升级功能
    QSS使用方法总结
    【QRegExp】QLineEdit屏蔽空格
  • 原文地址:https://www.cnblogs.com/zhuxiaoxi/p/9903167.html
Copyright © 2011-2022 走看看