Reputation: 9478
I am learning expressjs and connecting to MySQL database, but getting below error.
var express = require('express');
var path = require('path');
var mysql = require('mysql');
var app = express();
var connection = mysql.createConnection({
host : 'Damodars-MacBook-pro.local',
user : 'monty',
password : 'some_pass',
port : 3306,
});
connection.query('USE angularapp');
// Routing
// Configure port
app.set('port', 3006);
app.set('views', path.join(__dirname, 'views'));
app.set('view engine', 'jade');
app.use(express.static(path.join(__dirname, 'public')));
Getting error as:
Error: ER_NOT_SUPPORTED_AUTH_MODE: Client does not support authentication protocol requested by server; consider upgrading MySQL client at Handshake.Sequence._packetToError
Upvotes: 0
Views: 830
Reputation: 5002
As can be seen in the node-mysql
github repo, MySQL 8.0 is currently not supported. There is an open pull request to add the support.
Until a fix is released, I would recommend to install MySQL 5.7 instead of MySQL 8.0.
You can also try installing the Node library mysql2
instead of mysql
, but I am not sure whether it supports MySQL 8.0.
Upvotes: 1