项目场景:
nodejs操作mysql数据库,新增数据
问题描述
报错:ER_NOT_SUPPORTED_AUTH_MODE: Client does not support authentication protocol requested by server; consider upgrading MySQL client
原因分析:
MySQL8.0版本的加密方式和MySQL5.0的不一样,连接会报错。
解决方案:
1:通过命令行进入解压的mysql根目录下。
cd C:\Program Files\MySQL\MySQL Server 8.0\bin
2: 登陆数据库
mysql -u root -p
3:输入root的密码
4:ALTER USER ‘root’@‘localhost’ IDENTIFIED WITH mysql_native_password BY ‘123456’;