So i have been trying to connect to a MySQL database from my electron app:
<script>
var mysql = require('mysql');
var connection = mysql.createConnection({
host : '*********',
user : '******',
password : '******',
port : '******',
debug : 'true'
});
console.log('trying to connect to DB')
connection.connect(function(err) {
if (err) {
console.error('error connecting: ' + err.stack);
return;
}
console.log('connected as id ' + connection.threadId);
});
connection.end()
</script>
My code gets stuck on connection.connect and after about 1 min it give me:
error connecting: Error: read ECONNRESET
at exports._errnoException (util.js:1024:11)
at TCP.onread (net.js:610:25)
I have no idea what to do, anyone have any ideas?