Official example, follow this method to check out err. In addition to stack, you can also look at other contents, such as message, etc., and then locate the error.
var mysql = require('mysql');
var connection = mysql.createConnection({
host : 'example.org',
user : 'bob',
password : 'secret'
});
connection.connect(function(err) {
if (err) {
console.error('error connecting: ' + err.stack);
return;
}
console.log('connected as id ' + connection.threadId);
});
Official example, follow this method to check out err. In addition to stack, you can also look at other contents, such as message, etc., and then locate the error.
Try writing down the port number too