I\'m running a server on c9.io using Node.js and trying to connect to Mysql I guess I get this error:
Error: getaddrinfo ENOTFOUND
I almost spend two hours to understand what is the problem with the mysql database. I am using Windows cmd. I tried multiple ways e.g
npm install mysql2
localhost to 127.0.0.1
so in order to resolve this issue
[Error: getaddrinfo ENOTFOUND 127.0.0.1:3306]
I open XAMPP and start the MySQL database then manually check the credentials and works fine for me.
var mysql = require('mysql');
var connection = mysql.createConnection({
host : 'localhost',
user : 'test',
password: 'test123',
});