I'm trying to connect to a local mariadb server using node.js. When I try connecting I get the error:
"Error: (conn=8, no: 1045, SQLState: 28000) Access denied for user 'root'@'localhost' (using password: NO)"
I am not sure why this is, as I have the password set when I make the connection, and I can log into the mysql server using the root password with
mysql -u root -p
This is what my code looks like:
var mysql = require('mariadb');
var con = mysql.createConnection({
host: "localhost",
user: "root",
password: "8pJcpe/h0h_%",
port: 3306
})
.then(conn => {
console.log("connected" + conn.threadId);
})
.catch(err => {
console.log("got error " + err);
});
I have also tried it with port 3307, and get this error: "Error: connect ECONNREFUSED 127.0.0.1:3307"
When I try to use the port I am using to ssh into the server, I get this different error: " Error: (conn=-1, no: 45009, SQLState: 08S01) socket has unexpectedly been closed"
I am new to this and I could use some help. Thanks.