![](/img/trans.png)
[英]Error Connecting to the database: Error: ER_NOT_SUPPORTED_AUTH_MODE: Client does not support authentication protocol requested by server
[英]Node.js & MySQL - Error: 1251 - Client does not support authentication protocol requested by server; consider upgrading MySQL client
现在我只有这个代码:
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时,我得到了这个错误 。 我已经尝试了很多解决方案,包括我经常发现的解决方案, 但它没有用 。 所以现在我不知道该怎么做。 有人能帮助我吗?
谢谢
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password'
为我工作。 root密码更改为'password'
将插件更改为mysql_native_password可能会解决问题!
use mysql;
update user set authentication_string=password(''), plugin='mysql_native_password' where user='root';
基本上当我试图连接到Mysql查询浏览器时,我正面临着这个问题。
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'root'
为我工作。 root密码更改为“root”
我发现我是由不正确的参数引起的。
{ database: 'abc',
username: undefined,
password: 'efsefs',
}
用户名未定义,但错误是“考虑升级MySQL客户端”因此修改用户名为true,错误已解决。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.