1: 问题描述
按照教程 使用node.js 连接数据库 数据库安装调试完毕 也有基本的数据但是用node.js 连接就是报错 报错内容为:
Client does not support authentication protocol requested by server; consider upgrading MySQL client
2: 相关代码
MYSQL_CONF = {
host: 'localhost',
user: 'root',
password: '*****',
port: '3306',
database: 'blog'
}
`const mysql = require('mysql')
const { MYSQL_CONF} = require('../config/db')
// 创建链接对象
const con = mysql.createConnection(MYSQL_CONF)`
账号密码数据库名均正确
3: 报错信息: Client does not support authentication protocol requested by server; consider upgrading MySQL client
因为没有后端经验所以看了很多答案也不是太明白而且也没有解决问题 请问各位大神这是什么情况谢谢啦
应该是你的环境的问题,报错的意思就是你的mysql不支持授权的协议,建议你升级mysql的版本试试