Nodejs 连接mysql8 报错

前言

nodejs连接mysql8报错

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

解决方法

mysql -u root -p
ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY '123456';
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '123456';
FLUSH PRIVILEGES;
SELECT Host, User, plugin from mysql.user;

 

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注