Node.js和MySQL-错误:1251-客户端不支持服务器请求的身份验证协议;考虑升级MySQL客户端 [英] Node.js & MySQL - Error: 1251 - Client does not support authentication protocol requested by server; consider upgrading MySQL client

查看:623
本文介绍了Node.js和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'

为我工作.超级用户密码更改为密码"

Worked for me. root password is changed to 'password'

这篇关于Node.js和MySQL-错误:1251-客户端不支持服务器请求的身份验证协议;考虑升级MySQL客户端的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆