Monday, 7 January 2019

Any way to find out why I can't connect to MySQL database... All I get is err response which is not helpful

I have a node js and MySQL server running locally, and cannot find out why I am unable to connect. I am able to get the DB server running using the credentials, but all I get is the error message that was coded in and I would like to know if there is somewhere I can go to find out why it is not connecting successfully. I'm thinking it's either a syntax error (Hoping this isn't it I've been looking the file up and down) or maybe a permissions issue but just want to know how I can look into this further.​​const mysql = require('mysql');​var mysqlConnection = mysql.createConnection({`host: 'localhost',` `user:'admin',` `password: 'root',` `database: 'myca'` });​mysqlConnection.connect((err)=>{​if(!err) `console.log('DB connection actually worked :)');` `else` `console.log('This sucks :( try something else ');` });​​

Submitted January 07, 2019 at 11:06AM by funwithafork

No comments:

Post a Comment