question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Error: connect ETIMEDOUT]

See original GitHub issue

Hello,i am having this error in my production server ,the same code its working on my UAT server. its giving me [Error: connect ETIMEDOUT]

{ [Error: connect ETIMEDOUT]
  errorno: 'ETIMEDOUT',
  code: 'ETIMEDOUT',
  syscall: 'connect',
  fatal: true }
mysql connection lost

my code-------

var config = require('./config')('prod');
var mysql = require('mysql');
module.exports = function() {
    var connection = mysql.createConnection({
        host               : config.DATABASE_HOST,
        user               : config.DATABASE_USER,
        password           : config.DATABASE_PASS,
        database           : config.DATABASE_NAME,
        multipleStatements : true
    });
    connection.connect(function(err) {
        if (!err) {
            console.log("mysql connected")
        } else {
            console.log("mysql connection lost");
        }
    });
    return connection;
} 

The db is hosted into a remote server and the DATABASE_USER has all the permission it needed. thanks in advance .

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:29 (9 by maintainers)

github_iconTop GitHub Comments

114reactions
dougwilsoncommented, Sep 25, 2016

Hi @cashFLO960 the error Error: connect ETIMEDOUT is from the Node.js networking code. It means that a TCP connection could not be established to your MySQL server. Usually this is a networking or firewall issue.

32reactions
fsenartcommented, Jun 11, 2018

Hi there,

When creating an RDS instance via the AWS web console and when following “default” settings, AWS puts your instance into a security group with inbound rules set to your machine IP. Also, everything will work when running on your local machine but will timeout when doing the same thing in Lambda.

Solution: modify the default security group inbound rules associated with your db instance.

Read more comments on GitHub >

github_iconTop Results From Across the Web

What could cause "connect ETIMEDOUT" error when the URL ...
The URL above cause some issues because HTTP does not exist at the beginning of URL so Just change it to it should...
Read more >
Fixing Etimedout error - Postman
The ETIMEDOUT error means that the request took more time than the webserver configuration allows and the connection has been closed by the...
Read more >
How do I resolve the error: connect etimedout
ETIMEDOUT (Operation timed out): A connect or send request failed because the connected party did not properly respond after a period of time....
Read more >
HOW can i solve the Error: connect ETIMEDOUT when try to ...
The error always states the Error: connect ETIMEDOUT… the funny thing is that i can connect the cluster with mysql client terminal and...
Read more >
Error: connect ETIMEDOUT - Salesforce Stack Exchange
ETIMEDOUT (Operation timed out): A connect or send request failed because the connected party did not properly respond after a period of time....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found