邓浩… 2022-09-27 00:39 采纳率: 0%
浏览 22

node执行mysql报错

ER_NOT_SUPPORTED_AUTH_MODE: Client does not support authentication protocol requested by server; consider upgrading MySQL client

/此为 用户路由模块的处理函数
// 导入数据库操作模块
const db = require('../db/index')

// 注册的处理函数
exports.reguser = (req, res) => {
// 获取客户端提交的数据
const userinfo = req.body;
console.log(userinfo);
// 对表单中的数据进行校验
if (!userinfo.username || !userinfo.password) {
return res.send({ status: 1, message: '您输入的用户名或者密码不合法' })
}
// 定义sql语句 查询
const sql = select * from ev_users where username=? //执行 SQL 语句并根据结果判断用户名是否被占用
db.query(sql, userinfo.username, (err, results) => {
// 执行 SQL 语句失败
if (err) {
return res.send({ status: 1, message: err.message })
}
// 用户名被占用
if (results.length > 0) {
return res.send({ status: 1, message: '用户名已经被占用' })
}
})

}
//登陆的处理函数
exports.login = (req, res) => {
res.send('login ok')
}

ER_NOT_SUPPORTED_AUTH_MODE: Client does not support authentication protocol requested by server; consider upgrading MySQL client
改过旧版本,还是不行

  • 写回答

1条回答 默认 最新

  • 心寒丶 全栈领域优质创作者 2022-09-27 05:42
    关注

    参考下这个http://t.csdn.cn/4Mr2w

    评论

报告相同问题?

问题事件

  • 创建了问题 9月27日

悬赏问题

  • ¥15 使用C#,asp.net读取Excel文件并保存到Oracle数据库
  • ¥15 C# datagridview 单元格显示进度及值
  • ¥15 thinkphp6配合social login单点登录问题
  • ¥15 HFSS 中的 H 场图与 MATLAB 中绘制的 B1 场 部分对应不上
  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配