Reputation: 355
I have a problem when I try to connect to a MySQL database hosted by OVH on NodeJS server. Here is the code :
var mysql = require('mysql');
var connection = mysql.createConnection({
host : 'my_ip',
port : '3306',
user : 'my_user',
password : 'my_pass',
connectTimeout : 10000
});
connection.connect(function(err) {
if (err) {
console.error('error connecting: ' + err.stack);
return;
}
console.log('connected');
});
But I get :
error connecting: Error: connect ETIMEDOUT
Everytime, not matter what I do, like changing the timeout, remove the port or anything else. Any idea ? I'm running this on ArchLinux x86_64
Upvotes: 1
Views: 2919
Reputation: 355
I finally found the answer : OVH doesn't allow customers to use their MySQL Database out of their services which means that if you want to run code using MySQL OVH database, you have to run the code into a OVH server.
Upvotes: 2
Reputation: 26
This looks like a timeout error. Please try taking the port number out of the quote marks. Hopefully this will fix the issue!
var connection = mysql.createConnection({
host : 'my_ip',
port : 3306,
user : 'my_user',
password : 'my_pass',
connectTimeout : 10000
});
Upvotes: 0