Re: Error: connect ETIMEDOUT

958 views
Skip to first unread message
Message has been deleted

Navi Aujla (Google Cloud Support)

unread,
Oct 25, 2017, 5:13:20 PM10/25/17
to gce-discussion
Hello 

I was able to find this thread [1] which may help you. I ran quick test to verify the mysql connection using the following js code and shows 'Connected!'

var mysql = require('mysql');


var con = mysql.createConnection({
  host
: "localhost",
  user
: "root",
  password
: ""
});


con
.connect(function(err) {
 
if (err) throw err;
  console
.log("Connected!");
});


However, this seems like a question that would be better posted to https://stackoverflow.com/ with the right tags to seek assistance from bigger technical community, rather than a google discussion post. This isn't the right place to look for 1-on-1 support, being the forum meant for the general discussion of the platform. 

[1] https://github.com/mysqljs/mysql/issues/1474



On Wednesday, October 25, 2017 at 11:04:06 AM UTC-4, 김선태 wrote:
I successfully ran my node.js file through mysql on local.
I want to run 24/7 my node.js so i decided to create google cloud vm instance.
installed mysql, node, unzip (via sudo apt-get update, sudo apt-get install mysql-server, sudo apt-get install unzip, sudo apt-get install -y nodejs)
and uploades my node.js zip file, then unziped my zip file, created mysql databse, added 'my google id'@'instance name', granted privileges.
I successfully installed 'npm install' but as soon as i typed 'node bin.js', below erros came out.

Error: connect ETIMEDOUT
    at Connection._handleConnectTimeout (/home/myid/unzipfiles/node_modules/mysql/lib/Connection.js:419:13)
    at Socket.g (events.js:292:16)
    at emitNone (events.js:86:13)
    at Socket.emit (events.js:185:7)
    at Socket._onTimeout (net.js:338:8)
    at ontimeout (timers.js:386:11)
    at tryOnTimeout (timers.js:250:5)
    at Timer.listOnTimeout (timers.js:214:5)
    --------------------
    at Protocol._enqueue (/home/myid/unzipfiles/node_modules/mysql/lib/protocol/Protocol.js:145:48)
    at Protocol.handshake (/home/myid/unzipfiles/node_modules/mysql/lib/protocol/Protocol.js:52:23)
    at Connection.connect (/home/myid/unzipfiles/node_modules/mysql/lib/Connection.js:130:18)
    at Object.<anonymous> (/home/myid/unzipfiles/getting-acc/get-history.js:12:12)
    at Module._compile (module.js:570:32)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
    at Module.require (module.js:497:17)

what should i do solve these problems?
Reply all
Reply to author
Forward
0 new messages