node.js - node连接mysql失败
ringa_lee
ringa_lee 2017-04-17 14:52:15
0
2
787


利用node连接mysql一直连接不上,userpassword没有错误

ringa_lee
ringa_lee

ringa_lee

reply all(2)
阿神

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);
});
伊谢尔伦

Try writing down the port number too

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template