nodejs连接mysql 8.4报错:Client does not support authentication protocol requested by server

nodejs连接mysql 8.4报错:Client does not support authentication protocol requested by server

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

如图: 

是因为mysql 8.4默认启用的加密方式是  caching_sha2_password,而nodejs是mysql_native_password,可以用 

SELECT user, host, plugin from mysql.user WHERE plugin='caching_sha2_password';

命令查询,当前哪些用户是caching_sha2_password加密方式:

如果用mysql_native_password对某个mysql用户加密认证,先修改my.ini中[mysqld]的配置,启用mysql_native_password:

[mysqld]
mysql_native_password=ON

然后,在mysql里面执行命令:

ALTER USER 'mysql的用户'@'%' IDENTIFIED WITH mysql_native_password BY '我的简单密码';

此时再查询:

SELECT user, host, plugin from mysql.user WHERE plugin='mysql_native_password';

mysql里面的退出命令:

exit

mysql各版本下载地址:

MySQL :: Download MySQL Community Server (Archived Versions)icon-default.png?t=O83Ahttps://downloads.mysql.com/archives/community/

MySQL下载安装配置和启动(Windows环境):

mysql数据库环境配置和安装启动,Windows-CSDN博客文章浏览阅读924次。先下载mysql的zip压缩包:MySQL :: Download MySQL Community Serverhttps://dev.mysql.com/downloads/mysql/下载解压后,配置my.ini文件,放到mysql的程序目录里面,my.ini文件:[mysqld]port=3306basedir=D:\mysql\mysql-8.0.27-winx64datadir=D:\mysql\data[client] port=3306default-character-s_数据库环境配置https://zhangphil.blog.csdn.net/article/details/122414377

 Windows环境NodeJS下载配置安装运行-CSDN博客文章浏览阅读304次,点赞3次,收藏4次。文章浏览阅读448次。NodeJs的npm安装install报错:code ERESOLVE ERESOLVE unable to resolve dependency tree。NodeJs的npm安装install报错:code ERESOLVE ERESOLVE unable to resolve dependency tree_node.js eresolve unable to resolve dependency tree-CSDN博客。如果不修改默认的安装包位置和缓存位置,会直接安装在C盘。https://blog.csdn.net/zhangphil/article/details/142687905

猜你喜欢

转载自blog.csdn.net/zhangphil/article/details/142698252