modules like MySQL connection not working

#3
by Ytosko - opened

When I created connection and testing, I have done all the setup i can even connect the db from my local computer but not on n8n. Please help

Error: connect ETIMEDOUT at PoolConnection._handleTimeoutError (/usr/local/lib/node_modules/n8n/node_modules/mysql2/lib/connection.js:205:17) at listOnTimeout (node:internal/timers:608:17) at processTimers (node:internal/timers:543:7)

In fact, I have not tested it on MySQL. I connected it to a Supabase database and created the same timezone used in the Supabase database.
Why did you test it on MySQL? Try setting it up on Supabase instead — it's free and sufficient.

Is the database you're trying to connect to running on your local machine (localhost), or is it hosted on an external server or cloud service (like Supabase, PlanetScale, or a MySQL instance on a VPS)?

Hey sorry i should have made myself clear. The space is working fine with supabase, the problem is in workflows i am trying to connect MySQL and when creating credentials, entering host, user, password etc correctly and saving that, it is trying the connection in mysql node, it was saying connection timeout. Then i dig deeper and found that it was giving that wired error.

I thought may be credentials i am entering is wrong then i tried to connect the sql from my computer to my server ip, it is working good on my local machine (connection successful)

The same error is also appearing when trying to create/run a ssh command

After the command, i went deeper and find out that the request is not even going to the mysql host or the server ip (in ssh command) somehow the space is blocking connection on external ip addresses through firewall or something like that

I dont know what to do please help (i tested many apis like google sheet, linked in, mailgun those are working fine though)

Thank you for the detailed explanation — it was very helpful.

Based on what you've described, the issue is not with your MySQL server or the credentials, but rather with the network restrictions imposed by the environment where n8n is running.

Since you're able to connect to services like Supabase, Google Sheets, and Mailgun without issues, but connections to MySQL and SSH time out, it strongly suggests that your n8n environment is blocking outbound traffic to external IP addresses, likely due to firewall or security policies.

From your setup, it appears you're running n8n on Hugging Face Spaces (hf.co).
If that’s the case, it's important to note that hf.co imposes strict limitations on outbound network access, especially for protocols like SSH and MySQL. Moreover, even common APIs like Facebook and WhatsApp are often blocked or unsupported in this environment.

🔧 Recommended Solutions:

  1. Hugging Face Spaces is not designed for workflows that require direct TCP/IP access to external servers (e.g., MySQL, SSH), nor does it support integrations like Facebook or WhatsApp APIs reliably.

  2. If your workflow requires access to such services, we strongly recommend migrating to a self-hosted n8n instance — for example, on your own VPS or using Docker. This gives you full control over the networking layer and firewall, allowing secure and reliable access to any external servers or APIs.

  3. Alternatively, if you're not ready to host n8n yourself, consider moving your MySQL database to a cloud-hosted service like Supabase or PlanetScale, which are more compatible with limited environments — provided you're only using HTTP-based APIs (which hf.co supports).

Let me know if you're planning to continue using Hugging Face Spaces or are open to migrating to a more flexible environment — I can provide specific steps based on your choice

EnzGamers changed discussion status to closed

Sign up or log in to comment