banner ad

NodeJs Error: connect ECONNREFUSED

| April 11, 2013 | 0 Comments
0 Flares 0 Flares ×

First  with NodeJS and mysql.  Error!

Environment: Ubuntu 12.04 LTS
node.js Version: v0.6.12
Mysql versions of :2.0.0-alpha7

My code:
var mysql = require (‘mysql’);
var the connection = mysql.createConnection ({
host: ‘127 .0.0.1 ‘,
user: ‘userme’
password: ‘sqllogin’
});

console.log (connection);

var databaseName = ‘usersdata’;

connection.connect (function (err) {
if (err) {console.log (err);}
else {console.log (‘mysql connected’);}
});

connection.end ();

The last error information (including connection output) is:

{Config:
{Host: ‘127 .0.0.1 ‘,
port: 3306
socketPath: undefined,
user: ‘nbook’
password: ‘sqllogin’,
database: undefined,
insecureAuth: false,
supportBigNumbers: false,
debug: undefined
timezone: ‘local’,
flags:”,
queryFormat: undefined,
pool: undefined,
typecast: true,
MaxPacketSize: 0
charsetNumber: 33
clientFlags: 193487},
_socket: undefined,
_protocol:
{Readable: true,
writable: true,
_config:
{Host: ‘127 .0.0.1 ‘,
port: 3306
socketPath: undefined,
user: ‘nbook’
password: ‘sqllogin’,
database: undefined,
insecureAuth: false,
supportBigNumbers: false,
debug: undefined
timezone: ‘local’,
flags:”,
queryFormat: undefined,
pool: undefined,
typecast: true,
MaxPacketSize: 0
charsetNumber: 33
clientFlags: 193487},
_connection: [Circular],
_callback: null
_fatalError: null,
_quitSequence: null,
_handshakeSequence: null,
_destroyed: false,
_queue: [] _handshakeInitializationPacket: null,
_parser:
{_supportBigNumbers: False,
_buffer: <Buffer>,
_longPacketBuffers: [] _offset: 0
_packetEnd: null,
_packetHeader: null,
_onPacket: [Function],
_nextPacketNumber: 0
_encoding: ‘utf-8’,
_paused: false}},
_connectCalled: false}
Express is listening.
{[Error: connect ECONNREFUSED] code: ‘ECONNREFUSED’,
errno: ‘ECONNREFUSED’,
syscall: ‘connect’,
fatal: true}

Sincerely for help!

Online to check what port localhost like, say socket problem, but my computer / var / run and no such socket problem . How to install it?

Download PDF
0 Flares Twitter 0 Facebook 0 Google+ 0 Pin It Share 0 LinkedIn 0 Reddit 0 StumbleUpon 0 0 Flares ×

Tags: ,

Category: NodeJs

About the Author ()

My name is John Link.I am 26 years old. My major is Computer science and technology. I am a junior programmer with Python.

Leave a Reply

Your email address will not be published. Required fields are marked *

0 Flares Twitter 0 Facebook 0 Google+ 0 Pin It Share 0 LinkedIn 0 Reddit 0 StumbleUpon 0 0 Flares ×