Node failed to connect to mysql

  node.js, question

Node has been unable to connect mysql.userAndpasswordNo error

Official example, according to this method, err can be rounded up and looked at, besides stack, other contents can be looked at, such as message and so on, and then the error can be located.

var mysql      = require('mysql');
 var connection = mysql.createConnection({
 host     : '',
 user     : 'bob',
 password : 'secret'
 connection.connect(function(err) {
 if (err) {
 Error ('errorconnecting:' plus err.stack');
 Log ('connected asid' plus connection.threadId);