相关推荐recommended
解决MySQL8.0报错Client does not support authentication protocol requested by server...问题
作者:mmseoamin日期:2023-12-14

解决MySQL8.0报错Client does not support authentication protocol requested by server; consider upgrading MySQL client问题

原创:丶无殇  2023-10-07


报错内容

解决MySQL8.0报错Client does not support authentication protocol requested by server...问题,在这里插入图片描述,第1张

使用node.js连接数据库MySQL 8时候,报错ER_NOT_SUPPORTED_AUTH_MODE,并且提示Client does not support authentication protocol requested by server; consider upgrading MySQL client:客户端不支持服务器请求的身份验证协议;考虑升级MySQL客户端;

报错原因

最新的MySQL模块并未完全支持MySQL 8.0的caching_sha2_password加密方式,而MySQL 8.0中默认仍然是caching_sha2_password加密方式,因此用户认证不通过了。

解决MySQL8.0报错Client does not support authentication protocol requested by server...问题,在这里插入图片描述,第2张

如下查询:

mysql> alter user 'root'@'localhost' identified by '123456';
Query OK, 0 rows affected (0.02 sec)

解决MySQL8.0报错Client does not support authentication protocol requested by server...问题,在这里插入图片描述,第3张

这里的“123456”是你自己的密码

解决方法

直接数据库工具里面修改加密方式mysql_native_password:

解决MySQL8.0报错Client does not support authentication protocol requested by server...问题,在这里插入图片描述,第4张

或者通过指令方式修改:

mysql> alter user 'root'@'localhost' identified with mysql_native_password by '123456';
Query OK, 0 rows affected (0.01 sec)

解决MySQL8.0报错Client does not support authentication protocol requested by server...问题,在这里插入图片描述,第5张

数据库连接和关闭都成功,连接问题解决

解决MySQL8.0报错Client does not support authentication protocol requested by server...问题,在这里插入图片描述,第6张