Client does not support authentication protocol requested by server; consider upgrading MySQL client
node js 连接数据库报错
code: 'ER_NOT_SUPPORTED_AUTH_MODE',
errno: 1251,
sqlMessage: 'Client does not support authentication protocol requested by server; consider upgrading MySQL client',
sqlState: '08004',
fatal: true
我的 mysql 还是 docker
进入 容器中
docker exec -it c5dd28105fe5 /bin/bash
输入密码
mysql -u root -p
ALTER USER 'root' IDENTIFIED WITH mysql_native_password BY '123456';
刷新
flush privileges;
测试成功连接了
节点.js - MySQL 8.0 - 客户端不支持服务器请求的身份验证协议;考虑升级 MySQL 客户端 - 堆栈溢出 (stackoverflow.com)