node连接Mysql报错:Error: ER_NOT_SUPPORTED_AUTH_MODE: Client does not support authentication .......

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接: https://blog.csdn.net/qq_28004379/article/details/84652593

报错提示

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

报错原因:mysql8.0以上加密方式,Node还不支持。

解决方案

打开MySql命令行终端输入;【1234是我本地登录MySql的账号】

alter user 'root'@'localhost' identified with mysql_native_password by '1234';
flush privileges;

然后就解决了,如果不行的话就下载个低版本的mysql。

【补充:】

flush privileges 命令本质上的作用是将当前user和privilige表中的用户信息/权限设置从mysql库(MySQL数据库的内置库)中提取到内存里。经常用在改密码和授权超用户。

猜你喜欢

转载自blog.csdn.net/qq_28004379/article/details/84652593
今日推荐