问题描述node版本为8.9.2,连接mysql8.0,显示连接成功但是报错,报错为:Error: ER_NOT_SUPPORTED_AUTH_MODE: Client does not support authentication protocol requested by server; consider upgrading MySQL client相关代码const mysql = require('mysql')const db = mysql.createConnection({
host: 'localhost',
user: 'root',
password: '123456',
database: 'test_self',
})
db.query('SELECT * FROM `users`', (err, data) => { console.log('成功') // 这里可以打出'成功'
if (err) { console.log(err) // 这里报错
} else { console.log(data)
}
})
添加回答
举报
0/150
提交
取消