I'm working behind a proxy and I'm trying to access a following public database.
The connection works using a mysql client, from my workplace:
$ mysql -A -u genome -h genome-mysql.cse.ucsc.edu -P 3306 -D hg19 -e 'select now()'
+---------------------+
| now() |
+---------------------+
| 2014-03-06 01:56:36 |
+---------------------+
Now, I'm trying to do the same thing using node :
var mysql = require('mysql');
var connection = mysql.createConnection({
debug:true,
trace:true,
host : 'genome-mysql.cse.ucsc.edu',
port : 3306,
database: 'hg19',
user : 'genome',
password: ''
});
connection.connect(function(err) {if(err!=null) console.log(err);});
connection.end();
It works from my home but it raises an error from my workplace
{ [Error: connect ECONNREFUSED]
code: 'ECONNREFUSED',
errno: 'ECONNREFUSED',
syscall: 'connect',
fatal: true }
same error using : _socket: '/var/run/mysqld/mysqld.sock'
as connect ECONNREFUSED - node js , sql
Any suggestion on how to fix this ?
fixed. That was a problem with my version of node.js:
fixed. It was a probem with my node on ubuntu
lindenb@hardyweinberg:~/tmp/NODE$ /usr/bin/node -v && /usr/bin/node test2.js
v0.6.12
{ [Error: connect ECONNREFUSED]
code: 'ECONNREFUSED',
errno: 'ECONNREFUSED',
syscall: 'connect',
fatal: true }
vs
$ ~/package/node/bin/node -v && ~/package/node/bin/node test2.js
v0.10.26
<-- HandshakeInitializationPacket
{ protocolVersion: 10,
serverVersion: '5.6.10-log',
threadId: 9810250,
scrambleBuff1: <Buffer 46 33 6a 3f 39 41 79 61>,
filler1: <Buffer 00>,
serverCapabilities1: 63487,
serverLanguage: 8,
serverStatus: 2,
serverCapabilities2: 32895,
scrambleLength: 21,
filler2: <Buffer 00 00 00 00 00 00 00 00 00 00>,
scrambleBuff2: <Buffer 5a 7c 26 43 5c 28 50 3c 79 6d 39 71>,
filler3: <Buffer 00>,
pluginData: 'mysql_native_password',
protocol41: true }
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.