Node.js amp; MySQL - Error: 1251 - Client does not support authentication protocol requested by server; consider upgrading MySQL client(Node.js amp;MySQL - 错误:1251 - 客户端不支持服务器请求的身份验证协议;考虑升级 MySQL 客户端)
问题描述
现在我只有这个代码:
const Sequelize = require('sequelize');
const sequelize = new Sequelize('database', 'root', 'passwd', {
host: 'localhost',
dialect: 'mysql',
// http://docs.sequelizejs.com/manual/tutorial/querying.html#operators
operatorsAliases: false
});
sequelize
.authenticate()
.then(() => {
console.log('Connection has been established successfully.');
})
.catch(err => {
console.error('Unable to connect to the database:', err);
});
但是当我尝试运行 .js 时,我得到 这个错误.我已经尝试了很多解决方案,包括我发现 更多但它没有工作.所以现在我不知道该怎么办.有人可以帮帮我吗?
But when I try to run the .js I get this error. I have already tried a lot of solutions out there, including the one I found more often but it didn't work. So right now I don't know what to do. Can somebody help me?
谢谢
推荐答案
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password'
为我工作.root密码改成'password'
Worked for me. root password is changed to 'password'
这篇关于Node.js &MySQL - 错误:1251 - 客户端不支持服务器请求的身份验证协议;考虑升级 MySQL 客户端的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:Node.js &MySQL - 错误:1251 - 客户端不支持服务器请求的身份验证协议;考虑升级 MySQL 客户端
基础教程推荐
- 表 './mysql/proc' 被标记为崩溃,应该修复 2022-01-01
- 二进制文件到 SQL 数据库 Apache Camel 2021-01-01
- oracle区分大小写的原因? 2021-01-01
- 在 MySQL 中:如何将表名作为存储过程和/或函数参数传递? 2021-01-01
- 如何在 SQL 中将 Float 转换为 Varchar 2021-01-01
- MySQL 中的类型:BigInt(20) 与 Int(20) 2021-01-01
- mysql选择动态行值作为列名,另一列作为值 2021-01-01
- 什么是 orradiag_<user>文件夹? 2022-01-01
- 在多列上分布任意行 2021-01-01
- 如何根据该 XML 中的值更新 SQL 中的 XML 2021-01-01
