var express = require('express');
var mysql = require('mysql');
var connection = module.exports = mysql.createConnection({
host: 'myhost.com',
port:'3307',
user: 'username',
password: 'password',
database: 'mydatabase'
});
connection.connect(function(err) {
if (err){
throw err;
}
else
console.log('You are now connected...');
});
Sometimes when I try to connect to the database I get read ECONNRESET error. Please help. I tried many things, but nothing seems to work.