I had completed my website (React+node+express+mysql). and i want to host my whole website in linux server. i successfully created the database in mysql but i encountered some error.
I tried this solution already. it didn't work for me
My error is
Error connecting to database: Error: connect ECONNREFUSED 185.181.11.232:3306
I created my database like this
const connection = mysql.createConnection({
host: "localhost",
user: "root",
password: "***",
database: "attendance"
});
connection.connect(function (error) {
if (error) {
console.error('Error connecting to database: ' + error.stack);
return;
}
console.log('Connected to database with ID ' + connection.threadId);
});
Please give me some suggestion how can i correct this
I am expecting to output like this Connected to database with ID