'How to connect to mysql server with electron?
I'm trying to connect my electron app to a database, but I keep getting the same error
ETIMEOUT
or that the user don't have access
But if I try with my local database works fine, any ideas of why is this happening?
var mysql = require('mysql');
// Add the credentials to access your database
var connection = mysql.createConnection({
host : 'xxx.xxx.xxx',
user : 'xxxxx',
password : 'xxxxxxx',
database : 'xxxxx',
pool: {
max: 1000,
min: 0,
idleTimeoutMillis: 30000000
},
options: {
"enableArithAbort": false,
"encrypt": false
},
debug: true
});
// connect to mysql
connection.connect(function(err) {
if(err){
console.log(err.code);
console.log(err.fatal);
} else {
console.log("OK");
}
});
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
