zoukankan      html  css  js  c++  java
  • SQLSTATE[HY000] [2054] The server requested authentication method unknown to the client

    • 安装 nextcloud 的时候选择的是 mysql ,在链接 mysql 的时候报错,信息如下:

      SQLSTATE[HY000] [2054] The server requested authentication method unknown to the client
      
    • 搜索了下应该是 MySQL 8默认使用了新的密码验证插件:caching_sha2_password ,而有些 PHP 版本不支持这个问题造成的

    • 解决办法:

      • 修改登录用户的 plugin 为 mysql_native_password

        mysql -uroot -p
        use mysql;
        ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '密码';
        FLUSH PRIVILEGES;
        
      • 以上修改完成以后,本地链接没有问题,但是远程连接还是不行,需要修改 host 为 %

        update user set host = '%' where user ='root';
        
      • 假如上一步修改不成功,提示有重复数据 Duplicate entry '%-root' for key 'user.PRIMARY',删除其他的信息

        delete user where user='root' and host ='%';
        
    • 以上可以解决了已建账号的密码认证问题

    • 确保新添加的用户可以正常使用,需要把配置文件修改了

      • 配置文件:/etc/mysql/my.cnf
      • 解决办法:打开该文件,在 [mysqld] 模块下面添加一句 default_authentication_plugin=mysql_native_password
  • 相关阅读:
    Grovvy初识
    在eclipse中安装插件
    解决 APPARENT DEADLOCK!!! Creating emergency threads for unassigned pending tas
    Axis2 webservice入门--Webservice的发布与调用
    一步一步教你自定义博客园(cnblog)界面
    Enum枚举
    并行与并发
    多线程join(加入)
    守护线程
    停止线程
  • 原文地址:https://www.cnblogs.com/liyiran/p/12573765.html
Copyright © 2011-2022 走看看