I just downloaded MariaDB 10.3 for Windows ,created a database and trying to connect from a NodeJS server using mysql
library.
var mysql = require('mysql');
var con = mysql.createConnection({
host: "localhost",
user: "root",
password: "MariaDBPass",
database:'DB_NAME',
});
con.connect(function(err) {
if (err) throw err;
console.log("Connected!");
con.query(sql, function (err, result) {
if (err) throw err;
console.log("Result: " + result);
});
});
I tried it on Ubuntu and it's working but on windows it throws an non-sql error:
Client does not support authentication protocol requested by server; consider upgrading MariaDB client
I've red that maybe it is an incompatibility between MySQL 8.0 and the library(mysql
).
I've already tried to alter the user as following :
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password'
but it said that
there is an SQL Syntax Error
Any ideas on how to solve this?