Answer the question
In order to leave comments, you need to log in
How to connect MySQL database on hosting?
How to connect a database on the server.
Constantly writes an error: Error: connect ETIMEDOUT 94.241.44.78:3306
const connection = mysql.createConnection({
host: 'localhost',
user: 'test',
password: 'test',
port: 3306
});
Answer the question
In order to leave comments, you need to log in
I'm certainly not an expert, but ... there was no need to specify the database? type database: "test",
and the port, if nothing was specially configured, can be omitted. works for me like this:
const connection = mysql.createConnection({
host: "localhost",
user: "root",
database: "forum",
password: "12345"
}).promise();
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question