NodeJS连接mysql,报错ER_NOT_SUPPORTED_AUTH_MODE: Client does not support authentication protocol requested by server; consider upgrading MySQL client
我是mysql8.0以上的版本,在用NodeJS连接服务器中mysql数据库时开始报错

这表示服务器启动起来,但是数据库中密码协议出错,我从网上查到的结果告诉我,是mysql8.0支持了一个新的密码协议,但是NodeJS目前还没有支持导致的。
下面是我避坑后的解决方案,可能不适用于所有人
1. 登陆服务器中mysql
以管理员身份打开命令行,输入
mysql -u administrator -p
如果提示mysql不是可执行文件,可以在命令行中cd,直到mysql 中的bin目录,或者把mysql加入环境变量
注意:上面的root是你要修改的用户名,可能不是administrator,我的就是administrator

2. 输入密码
然后输入密码,进入mysql
3. 选择数据库
所以,首先我们需要选择数据库,在命令行中输入
use mysql
注意:这里就是mysql,不是别的名称,除非你修改了数据库中存储用户名密码的表的名称,但是这种几率很小,你动不到那里

如果选错数据库的话,会在后续密码置空操作中提示下述错误

4. 密码置空
如果原密码不置空,直接修改密码的话,会报错

密码置空操作,输入
update user set authentication_string='' where user='administrator';
其中上述administrator仍然为你需要修改密码协议的用户名

5. 刷新
此步骤很重要
flush privileges;

6. 修改密码及协议
我在这一步卡了好久
我修改密码协议,出现图中错误

查了很多资料,我明白了
打开数据库,mysql库,user表,可以看到

在我要修改的用户名前的host中是‘%’,而不是‘localhost’,所以我需要将命令中的 localhost 改为 %
alter user 'administrator'@'%' identified with mysql_native_password by '123456';
上述administrator为你需要修改密码的用户名,123456中为你的密码

至此,即完成全部步骤
mysql忘记密码修改等,网上很多教程好像不适用于mysql8.0,有时间把这部分写一下。
NodeJS连接mysql,报错ER_NOT_SUPPORTED_AUTH_MODE: Client does not support authentication protocol requested by server; consider upgrading MySQL client的更多相关文章
- egg 连接 mysql 的 docker 容器,报错:Client does not support authentication protocol requested by server; consider upgrading MySQL client
egg 连接 mysql 的 docker 容器,报错:Client does not support authentication protocol requested by server; con ...
- 图文并茂解决Client does not support authentication protocol requested by server; consider upgrading MySQL
今天服务器部署node.js+mysql,调用接口报错ER_NOT_SUPPORTED_AUTH_MODE: Client does not support authentication protoc ...
- Client does not support authentication protocol requested by server; consider upgrading MySQL client
出现错误 Client does not support authentication protocol requested by server; consider upgrading MySQL c ...
- UnhandledPromiseRejectionWarning: SequelizeConnectionError: Client does not support authentication protocol requested by server; consider upgrading MySQL client
UnhandledPromiseRejectionWarning: SequelizeConnectionError: Client does not support authentication p ...
- node mysql问题:Client does not support authentication protocol requested by server; consider upgrading MySQL client!
node后台 mysql处理模块(版本:2.16.0) 执行connect方法时报错: Client does not support authentication protocol requeste ...
- MySQL安装教程及Navicat连接MySQL报错:1251-Client does not support authentication protocol requested by server
MySQL安装可参考: MySql 8.0.18安装 此参考文章后面涉及到的密码修改,对本标题碰到的错误同样适用. 本文先讲如何安装,在讲碰到的1251问题.要直接看解决方案的朋友可以直接通过目录链接 ...
- vscode Error: ER_NOT_SUPPORTED_AUTH_MODE: Client does not support authentication protocol requested by server; consider upgrading MySQL client
vscode 连接 mysql 时出现这个错误 alter user 'root'@'localhost' identified with mysql_native_password by 'pass ...
- Mysql8 连接提示 Client does not support authentication protocol requested by server; consider upgrading MySQL client 解决方法
USE mysql;ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password';FLUSH PR ...
- docker安装mysql容器后,是用navicat连接报client does not support authentication protocol requested by server consider upgrading mysql client
#进入容器 docker exec -it mysql bash#进入mysqlmysql -u root -p#重置密码ALTER USER 'root'@'%' IDENTIFIED WITH m ...
- django.db.utils.OperationalError: (1251, 'Client does not support authentication protocol requested by server; consider upgrading MySQL client')
1.打开MySQL: cmd里 net start mysql mysql -hlocalhost -uroot -p回车 进入mysql数据库 2. 命令如下: 1.use mysql; 2.alt ...
随机推荐
- 《深入理解Java虚拟机》读书笔记:垃圾收集器
垃圾收集器 HotSpot虚拟机包含的所有收集器如图3-5所示.图3-5展示了7种作用于不同分代的收集器,如果两个收集器之间存在连线,就说明它们可以搭配使用. 新生代收集器:Serial.ParNew ...
- quarkus数据库篇之二:无需数据库也能运行增删改查(dev模式)
欢迎访问我的GitHub 这里分类和汇总了欣宸的全部原创(含配套源码):https://github.com/zq2599/blog_demos 本篇概览 本篇内容并非数据库相关的核心知识,而是对一个 ...
- Linux第四章(80X86保护模式及其编程)
80X86保护模式及其编程 80X86基础知识 保护模式内存管理 各种保护措施 中断和异常处理 任务管理 保护模式编程的初始化 一个简单的多任务内核 4.1 80X86系统寄存器和系统指令 为了协助处 ...
- ffmpeg 在xp和server2003/2008/2012上修复无法定位GetNumaNodeProcessorMaskEx的问题
问题 在给开发一个手机视频网站时需要用到ffmpeg截取视频缩略图, 把项目提交到服务器(server2003/ server2008)上时, 发现在调用命令时会出现错误"无法定位GetNu ...
- Codeforces Round 882 div.2 A
Smiling&Weeping ----总有人间一两风,填我十万八千梦 A. The Man who became a God time limit per test 1 second mem ...
- C++的动态分派在HotSpot VM中的重要应用
众所周知,多态是面向对象编程语言的重要特性,它允许基类的指针或引用指向派生类的对象,而在具体访问时实现方法的动态绑定.C++ 和 Java 作为当前最为流行的两种面向对象编程语言,其内部对于多态的支持 ...
- destoon关于archiver归档的性能优化
今天在处理一个项目时候发现archiver单个模块归档超过百万数据,打开速度就特慢,所以打开archiver下index.php文件进行分析,发现有句sql作怪 1 $result = $db-> ...
- fmpeg 多张图片转视频,视频转gif,截取视频,截取视频里的帧
ffmpeg 多张图片转视频,视频转gif,截取视频,截取视频里的帧 月色下的独轮车 于 2017-06-20 17:32:01 发布 6250 收藏 3文章标签: ffmpeg版权 android学 ...
- Thinking in Java 4th Edition Source Code
Thinking in Java 4th Edition Source Code Instructions for downloading, installing and testing the so ...
- docker入门加实战—docker常见命令
docker入门加实战-docker常见命令 在介绍命令之前,先用一副图形象的展示一下docker的命令: 常见命令 docker的常见命令和文档地址如下表: 命令 说明 文档地址 docker pu ...