错误提示:The server requested authentication method unknown to the client [caching_sha2_passWord] 一、原因 从Mysql 8.0.4开始,mysql服
错误提示:The server requested authentication method unknown to the client [caching_sha2_passWord]
从Mysql 8.0.4开始,mysql服务器的默认身份验证插件从mysql_native_password更改为caching_sha2_password。相应地,libmysqlclient现在也将caching_sha2_password用作默认身份验证机制。
在MySQL 8.0 Command Line Client命令窗口,输入密码,
输入use mysql;
输入SELECT Host, User, plugin from user;
可以看出使用的都是caching_sha2_password用作默认身份验证机制(这里的红框,是我解决后的图片,原来4个都是caching_sha2_password)
常见解决方法,直接接着上面的步骤,
先输入 ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '新密码';修改权限
再输入FLUSH privileges;刷新权限
到了这一步大部分人就好了,但是我却不行,我后面查了好久,才发现要在C:\ProgramData\MySQL\MySQL Server 8.0下面(这是隐藏文件)的my.ini 这个配置文件里的[mysqld]这个部分,添加default_authentication_plugin=mysql_native_password这句代码才行,然后重启服务,一切拨开云雾见月明,搞定!
来源地址:https://blog.csdn.net/weixin_42966151/article/details/127777374
--结束END--
本文标题: PHP连接MYSQL8.0失败,提示[caching_sha2_password]错误解决办法
本文链接: https://www.lsjlt.com/news/384990.html(转载时请注明来源链接)
有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341
下载Word文档到电脑,方便收藏和打印~
2024-05-03
2024-05-03
2024-05-03
2024-05-03
2024-05-03
2024-05-03
2024-05-03
2024-05-03
2024-05-03
2024-05-03
回答
回答
回答
回答
回答
回答
回答
回答
回答
回答
0