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 socket.io . 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.
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.
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.
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?
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).
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.