Host issues with mysql!

Idk what this categorizes as, but ok. My issue is this:


const mysql = require(“mysql”);
const con = mysql.createConnection({
host: “MY-SHW-LINK.shw.io”,
user: “root”,
password: process.env.MYSQLPASSWORD,
database: “ramfish”
})
con.connect(err => {
if(err) console.log(err.message);
});


When i run this, all i get is an error saying: connect ETIMEDOUT or connect ECONNREFUSED 127.0.0.1:3306
and i donw know what to put in the host name, i tried my shw.io and my servers ip adress and localhost. I need help.

Only port 3000 can be exposed to the internet. However, if your running the database inside of your project you should use 127.0.0.1 for the IP.

1 Like