ER_NOT_SUPPORTED_AUTH_MODE:客户端不支持服务器请求的身份验证协议.考虑升级MySQL客户端 [英] ER_NOT_SUPPORTED_AUTH_MODE: Client does not support authentication protocol requested by server; consider upgrading MySQL client
本文介绍了ER_NOT_SUPPORTED_AUTH_MODE:客户端不支持服务器请求的身份验证协议.考虑升级MySQL客户端的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
nodejs中使用的mysql问题
const mysql = require('mysql');
var connection = mysql.createConnection({
host : 'localhost',
user : 'root',
password : '123456789',
database : 'userdata'
});
connection.connect(function(err) {
if (err) {
console.error('error connecting: ' + err);
return;
}
console.log('connected as id ' + connection.threadId);
});
错误: ER_NOT_SUPPORTED_AUTH_MODE:客户端不支持服务器请求的身份验证协议;考虑升级MySQL客户端
推荐答案
出现相同的问题.
Install MySQL Workbench
执行以下查询:MySQL Workbench中的ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '123456789';
Execute this query: ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '123456789';
in MySQL Workbench
返回到Node.js,然后尝试再次运行该文件.它应该起作用,至少对我有用.
Head back over to Node.js and try running the file again. It should work, at least it did for me.
这篇关于ER_NOT_SUPPORTED_AUTH_MODE:客户端不支持服务器请求的身份验证协议.考虑升级MySQL客户端的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文