ETIMEDOUT when trying to connect to a MySQL server.
See original GitHub issueI’m trying to connect to my SQL server but I’m getting an ETIMEDOUT error:
error connecting: Error: connect ETIMEDOUT at Connection._handleTimeoutError (C:\Users\me\Desktop\Emberlox Bot\node_modules\mysql2\lib\connection.js:169:17) at ontimeout (timers.js:436:11) at tryOnTimeout (timers.js:300:5) at listOnTimeout (timers.js:263:5) at Timer.processTimers (timers.js:223:10)
Here is my code:
`var mysql = require(‘mysql2’);
var connection = mysql.createConnection({
host : ‘brick-city.com’,
user : ‘root’,
password : ‘snip’,
port : 3306
});
connection.connect(function(err) { if (err) { console.error('error connecting: ’ + err.stack); return; }
console.log('connected as id ’ + connection.threadId); });`
I’m using latest node and latest mysql2
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:5 (3 by maintainers)
i am having this same issue actually, my use case is a docker container on an ec2 instance, trying to connect to amazon aurora mysql RDS. I am able to shell into the container and run mysql cli to connect to the rds instance without issue, but for some reason the node app is unable to. nslookup and ping are resolving the host properly, i have tried the endpoint (hostname) as well as the private ip, both of which work at the command line. I’m using node 10LTS.
@sidorares my apologies, after some additional testing it looks like this was a configuration issue in the docker-compose file ENV values. Please consider my issue resolved.