MySQL Server not accepting connections

Username: 1

Password: 1

(its a protected directory)

I am testing a kind of forum. I also want it to be in real time, so users from different windows can see new messages without having to refresh the site or go into it again. Now of course for this we use WebSockets and . I tested it and it works. It sends the messages in real time. However, when i refresh the site or go into it again, all the messages disappear. Now of course if i want to save the messages i use an MySQL Database. However, i get an error in the terminal when i run “node .”

Error connecting to the database: Error: connect ETIMEDOUT
at Connection._handleConnectTimeout (C:\Users\HP\Desktop\server\node_modules\mysql\lib\Connection.js:409:13)
at Object.onceWrapper (node:events:628:28)
at Socket.emit (node:events:514:28)
at Socket._onTimeout (node:net:571:8)
at listOnTimeout (node:internal/timers:569:17)
at process.processTimers (node:internal/timers:512:7)
at Protocol._enqueue (C:\Users\HP\Desktop\server\node_modules\mysql\lib\protocol\Protocol.js:144:48)
at Protocol.handshake (C:\Users\HP\Desktop\server\node_modules\mysql\lib\protocol\Protocol.js:51:23)
at Connection.connect (C:\Users\HP\Desktop\server\node_modules\mysql\lib\Connection.js:116:18)
at Object. (C:\Users\HP\Desktop\server\index.js:16:12)
at Module._compile (node:internal/modules/cjs/loader:1256:14)
at Module._extensions…js (node:internal/modules/cjs/loader:1310:10)
at Module.load (node:internal/modules/cjs/loader:1119:32)
at Module._load (node:internal/modules/cjs/loader:960:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
at node:internal/main/run_main_module:23:47 {
errorno: ‘ETIMEDOUT’,
code: ‘ETIMEDOUT’,
syscall: ‘connect’,
fatal: true

The error message says that the connection timed out even before the connect timeout value was reached. This means that the database server is not even accepting connections.

So as usual i tried to test the connection.


Pinging [] with 32 bytes of data:
Request timed out.
Request timed out.
Request timed out.
Request timed out.

Ping statistics for
Packets: Sent = 4, Received = 0, Lost = 4 (100% loss),

What is the issue here???

You cannot connect to MySQL from an external application on our hosting.

Additionally, our servers are set up to not respond to pings for security purposes and so we can keep the servers fast for their appropriate functions.

Also, if you try to ping any of the sql servers from your home machine, it will either fail or it will respond with a device from your local network, as 192.168.0.x is a local address.


Well then exactly how can i make the messages send in real time while saving???

Adding to what @wackyblackie had said, this is considered as live chat, which is forbiddened to run directly on our servers, as it consume a lot a server power, and will eventually get your account suspended. Even if we didn’t discover this, your account will also be suspended due to reaching the daily hit limit.


Easy. Run your code on our hosting. But take notice of what I had told you above.

I also see a lot of “node” in your code. I suppose it means Node.js and unfortunately isn’t supported by our hosting.


And how exactly do i do that? Is there a tutorial?

Since you are hosting your node.js app locally, you might have a better luck installing mysql server locally as well.


it has already been said that infinityfree does not support node.js and that you cannot connect to mysql from an external application

That is why I am suggesting you to do things locally, Infinityfree is for hosting websites written in php, not a node.js or external database hosting.


Alright, i will try that and see if it works


I have downloaded everything from MySQL. however, when i run mysql --version just as a test, it says “‘mysql’ is not recognized as an internal or external command,
operable program or batch file.”, meaning i havent installed mysql. Whats the fix?

You should add its installation folder on your PATH, so the prompt can find executables from that folder as well. To do it see this article.


" * Under System Variables, select Path, and then click the Edit button. The Edit System Variable dialogue should appear."

There is no “Edit System Variable” dialogue. Instead, is it “Edit Environment Variable”.

“Place your cursor at the end of the text appearing in the space marked Variable Value”

There is no space in the Edit Environment Variable that is marked “Variable Value”.

It seems as if the tutorial you gave me is incorrect/outdated

Yes, please proceed.

You should click on something like “Add”


This article can help, then:

The official documentation is likely phrased around older versions on Windows, but the steps should still be similar. The article I linked to is set around newer versions (Windows 10 and 11).


still didnt work even after adding it

‘mysql’ is not recognized as an internal or external command,
operable program or batch file.

Did you also install MySQL Server 8.0 from the MySQL installer, or did you only install the installer? If the latter, open it to install MySQL.


Nevermind, i needed to run command prompt as an administrator. It works now


Strange. Were you trying to run the command in the same prompt you had before adding it to PATH? If so this is likely why it was failing, you’d needed to open a new command prompt for the new PATH values to take effect.

From this article:

After you change PATH with the GUI, close and reopen the console window.

This works because only programs started after the change will see the new PATH.


Do i have to use the MySQL workbench to run a mysql server locally?