Client does not support authentication protocol requested by server; consider upgrading MySQL client

出现错误 Client does not support authentication protocol requested by server; consider upgrading MySQL client

今天使用 typeorm 连接 mysql8.0.17 出现错误,出现的错误就是 Client does not support authentication protocol requested by server; consider upgrading MySQL client . 出现的原因 mysql8 之前的版本中加密规则是 mysql_native_password,而在 mysql8 之后,加密规则是 caching_sha2_password

解决方法

  1. 升级 navicat 驱动
  2. 把 mysql 用户登录密码加密规则还原成 mysql_native_password

使用方法 2 解决

查找 mysql 安装位置,我的使用 homebrew 安装的,所以可以直接使用 brew 命令进行查找

brew info mysql

可以查到 /usr/local/Cellar/mysql/8.0.17_1 (284 files, 272.4MB) 这是安装位置, 进入 mysql 的安装目录下的 bin 目录

cd /usr/local/Cellar/mysql/8.0.17_1
cd bin
mysql -u root -p

输入密码获取权限,之后接着输入

ALTER USER 'root'@'localhost' IDENTIFIED BY 'password' PASSWORD EXPIRE NEVER; #修改加密规则
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password'; #更新一下用户的密码
FLUSH PRIVILEGES; #刷新权限

再次进行连接,重新输入新的账号密码

上一篇:Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more i


下一篇:Tomcat启动时报StandardServer.await: create[8005]: java.net.BindException: Cannot assign requested add...