egg连接mysql 报错 Client does not support authentication protocol requested by serve

200 阅读1分钟

前几天重装了一下mac系统,用homebrew下载了mysql后,版本为8.0以上,egg启动报错

启动egg项目报错 “ Client does not support authentication protocol requested by serve” image.png

原因分析:8.0mysql引入了caching_sha2_password模块作为默认身份验证插件,nodejs还没有跟进

解决方案:

mysql -u root -p

输入密码

ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '自己的密码';