php 7.3连sqlserver教程,php7.3连接MySQL8.0报错 PDO::__construct(): The server requested authentication metho...

报的错误:

In Connection.php line 664:

SQLSTATE[HY000] [2054] The server requested authentication method unknown to the client (SQL: select * from information_schema.tables where table_schema = move and table_name = migrations and table_type = 'BASE TABLE')

In PDOConnection.php line 31:

SQLSTATE[HY000] [2054] The server requested authentication method unknown to the client

In PDOConnection.php line 27:

SQLSTATE[HY000] [2054] The server requested authentication method unknown to the client

In PDOConnection.php line 27:

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

原因:

mysql8默认的使用密码认证方式不一样,mysql8.0默认使用caching_sha2_password,但是之前版本都是使用mysql_native_password

解决方案

修改caching_sha2_password为mysql_native_password

select user,host,plugin from mysql.user;

7a2f95d841ab18c3b551c9f9cd37bbe0.png

我这里执行了两句修改,修改root身份的“localhost”和“%”,代码如下:

ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY 'root';

ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'root';

b5603d5b8d7715a357041e855e0ab406.png

执行成功:

eec36b752bf718398ed55b982cf8f0ed.png

标签:__,requested,unknown,authentication,报错,mysql,password,method

来源: https://www.cnblogs.com/hardykay/p/12092031.html

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值