So I'm trying to transition away from using xampp and using mysql workbench. I started up a local db connection and managed to successfully connect to it in my local environment through workbench. However, In my NodeJS file, I'm trying to connect to this local database instance but in my terminal, the condition statement is failing saying it's unsuccessful connecting to the local mysql instance and I'm not sure why.
local db workbench configuration:
user: root
password: (cant say but its my own password)
port: 3306
host: localhost
Screenshot of the service running:
NodeJS Code
var mysql = require("mysql");
var connection = mysql.createConnection({
host: "localhost",
user: "root",
password: "mydbpasswordishere",
database: "testdb",
port: 3306,
charset: "utf8mb4"
});
connection.connect(err => {
if (!err) {
console.log("DB Connection Succeeded");
} else {
console.log("DB Connection Failed");
}
});
module.exports = connection;