安装mysql8.0遇到的问题SQLSTATE[HY000] [2054] The server requested authentication method unknown to the client

单行、唯一 0     714      数据库   0     0
alter user 'root'@localhost IDENTIFIED WITH mysql_native_password BY '120120120';
先上解决方案

MacBook-Pro  ~  mysql -u root -p

Enter password: 

Welcome to the MySQL monitor.  Commands end with ; or \g.

Your MySQL connection id is 41

Server version: 8.0.34 Homebrew


Copyright (c) 2000, 2023, Oracle and/or its affiliates.


Oracle is a registered trademark of Oracle Corporation and/or its

affiliates. Other names may be trademarks of their respective

owners.


Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.


mysql> alter user 'root'@localhost IDENTIFIED WITH mysql_native_password BY '120120120';

Query OK, 0 rows affected (0.00 sec)


mysql> 


问题描述:
(1)安装好mysql8.0一切就绪后,工具能连接,命令行能链接,php代码访问出现:
SQLSTATE[HY000] [2054] The server requested authentication method unknown to the client

PDO::__construct(): The server requested authentication method unknown to the client [caching_sha2_password]

妈的,去chatgpt问了好几次,还是未得到解决

最后还是百度到的
captcha
忘记密码? 注册
第三方登录
微信赞赏
支付宝赞赏