Cannot connect to MySQL from n8n.cloud – ERROR: connect ETIMEDOUT

Hello, I have a problem with a connection to a MySQL database (managed db by DigitalOcean). I connect to this database externally from other tools, the credentials are the same. It does not work in the case of n8n. Even though I have whitelisted the IP (with help of @harshil1712).

Here are the details of an error I am getting:

Error: connect ETIMEDOUT
    at Object.createConnection (/usr/local/lib/node_modules/n8n/node_modules/mysql2/promise.js:241:31)
    at Object.execute (/usr/local/lib/node_modules/n8n/node_modules/n8n-nodes-base/dist/nodes/MySql/MySql.node.js:220:41)
    at Workflow.runNode (/usr/local/lib/node_modules/n8n/node_modules/n8n-workflow/dist/src/Workflow.js:492:37)
    at /usr/local/lib/node_modules/n8n/node_modules/n8n-core/dist/src/WorkflowExecute.js:424:62```

Is there anything I am doing wrong?
Thanks for a help.
Honza

Hi @harshil1712 – still no answers :frowning: . Would you be so kind as to try to advise me what to do? Thank you.

Hey @honzapav, sending you a Direct Message

1 Like

Hey @honzapav,

We deployed a test MySQL server and used the MySQL node to connect to it. We were successfully able to execute queries via the node.

Initially, we had SSL turned off and it was working as expected. We then turned it on to replicate your issue, but we couldn’t. After setting the SSL parameter to true in the node, and adding the certificate in the CA Certificate field we executed the node and got the expected results.

This confirms that the MySQL node is working as expected. It seems to be an issue with your MySQL server. You might be missing something over there. Maybe this post can help Nodejs connecting to managed mysql database ERR: connect ETIMEDOUT | DigitalOcean

Hi @harshil1712 , thanks for the information. I can download the CA certificate from DigitalOcean (it’s managed DB) but I don’t know how to get its content to CA certificate fields in credentials setup. Can you advise me how to do it? I tried to google it but haven’t found suitable info.

I used this database with other tools and never run into this issue – so if I add the CA certificate, it should work.

Thank you.

Hey @honzapav,

This is what our CA Certificate looked like:

-----BEGIN CERTIFICATE-----
SOMEVALUE
-----END CERTIFICATE-----
-----BEGIN CERTIFICATE-----
SOMEVALUE
-----END CERTIFICATE-----
-----BEGIN CERTIFICATE-----
SOMEVALUE
-----END CERTIFICATE-----
-----BEGIN CERTIFICATE-----
SOMEVALUE
-----END CERTIFICATE-----
-----BEGIN CERTIFICATE-----
SOMEVALUE
-----END CERTIFICATE-----

I copied this content and pasted it in the CA Certificate field, and then saved my credentials.

I hope this helps :slight_smile:

ok, this is what I would expect. Finally, I have just tried to open it in the text editor and it works :man_facepalming: :slightly_smiling_face:

But the connection still doesn’t work. I assume it is the firewall problem – most often, it is only a matter of white-labelling the IP address. Is it possible that it has changed since you’ve sent it to me? I understand the problem is on my side but as I use exactly the same database with Integromat, Parabola.io, Retool, … and it is a managed DB (on DigitalOcean) I can’t change (almost) any settings.

I can definitely use a different database but not for this project.
Anyway, thanks for the help. :pray:
H.

Hey @honzapav!

The IP address hasn’t changed. I have sent you the IP address over email. I am not sure why you’re not able to connect to your MySQL server.

@harshil1712 got it (it is the same one) – thanks for help! I will try to find some other way :slight_smile:
H.

1 Like

@harshil1712 Hi, I have finally solved this issue. Accidentally, I came across the installation guide that mention multiple IP addresses to whitelist. When I added all of them, not only the one I got before, it started to work. :tada: :tada: :tada:

Hope it helps someone :slight_smile:
Best!

2 Likes

That’s wonderful! We updated the docs very recently, and I am glad you found it!