Node failed to connect to mysql

  node.js, question

clipboard.png
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     : 'example.org',
 user     : 'bob',
 password : 'secret'
 });
 
 connection.connect(function(err) {
 if (err) {
 Error ('errorconnecting:' plus err.stack');
 return;
 bracket
 
 Log ('connected asid' plus connection.threadId);
 });