Run MySQL query ERROR: connect ETIMEDOUT

When I run MySQL query, I have this error, or load too long with “no result”
(Connected Credentials successfully)


Error: connect ETIMEDOUT
    at Object.createConnection (/usr/local/lib/node_modules/n8n/node_modules/mysql2/promise.js:231:31)
    at Object.execute (/usr/local/lib/node_modules/n8n/node_modules/n8n-nodes-base/dist/nodes/MySql/MySql.node.js:153:41)
    at Workflow.runNode (/usr/local/lib/node_modules/n8n/node_modules/n8n-workflow/dist/src/Workflow.js:583:37)
    at /usr/local/lib/node_modules/n8n/node_modules/n8n-core/dist/src/WorkflowExecute.js:369:62
    at /usr/local/lib/node_modules/n8n/node_modules/n8n-core/dist/src/WorkflowExecute.js:447:15
    at /usr/local/lib/node_modules/n8n/node_modules/p-cancelable/index.js:61:11
    at new Promise (<anonymous>)
    at new PCancelable (/usr/local/lib/node_modules/n8n/node_modules/p-cancelable/index.js:31:19)
    at WorkflowExecute.processRunExecutionData (/usr/local/lib/node_modules/n8n/node_modules/n8n-core/dist/src/WorkflowExecute.js:296:16)
    at (/usr/local/lib/node_modules/n8n/node_modules/n8n-core/dist/src/WorkflowExecute.js:59:21)

Are you sure that all the data is correct, especially the port? Is the MySQL server for sure reachable from n8n? Did you try to execute the same query directly in MySQL?

I think Credentials is completed, it means port’s already alright, right?

Do not understand the above picture as it seems like the “MySQL” node did not get executed.

I press button “Execute node”, it loads too long. After that, it has result like this image.

Very strange. Have never seen that before. If it executes but does not have a result it should look like this:

Is there any problem with firewall?

Yes that could be. For that reason did I ask if the MySQL server is for sure reachable from n8n. Because in the end does n8n not do anything special. So if it is reachable it should work.

So, why n8n has connected this Credentials successfully.
I think it needs have notice more clearly.

I adjusted everything in firewall. Now, i’m not sure about this issue

Do not understand what you mean with “n8n has connected this Credentials successfully”. When did it say so? All n8n does when you create credentials is saving them. If you literally type in “a” in each of the credential properties will it save them just fine.

1 Like

I mean mysql credential added to n8n
But why do we not test for confirmation of credential’s success, or we have a “test button” to khow what of cause exactly?

Normally, when credential added, its port is ok
Firewall issue is problem of credential, I think, in stead of node issues.

It seems credentials added and tested.

Well, when I take off route from MySQL node, it run and show this error:
(I think connection make this error can’t display)

ERROR: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ‘SELECT id FROM contact WHERE id LIKE ‘[email protected]’’ at line 1

Do you have any idea?

Error: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'SELECT id FROM contact WHERE id LIKE '[email protected]'' at line 1
    at PromiseConnection.query (/usr/local/lib/node_modules/n8n/node_modules/mysql2/promise.js:92:22)
    at /usr/local/lib/node_modules/n8n/node_modules/n8n-nodes-base/dist/nodes/MySql/MySql.node.js:160:35
    at (<anonymous>)
    at Object.execute (/usr/local/lib/node_modules/n8n/node_modules/n8n-nodes-base/dist/nodes/MySql/MySql.node.js:158:38)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
    at async /usr/local/lib/node_modules/n8n/node_modules/n8n-core/dist/src/WorkflowExecute.js:369:47

Why we do not test if the credentials are valid and a connection with them is possible? Very simply because it has not been programmed. There are probably a million things like this that could be added to n8n but somebody has to program them. As we do not have unlimited resources and additionally have to split our time between answering questions in the community like this and writing code, do we have to prioritize which features are more important than others. If you think that this is something that really has to exist in n8n we would be more than happy to merge a pull-request once you created it.

About the issue, you are having now. Do sadly not have the slightest idea. Looks correct for me. To be 100% sure I did test a similar request locally with MySQL where it worked fine. So maybe there is really a difference in recent MariaDB versions.

1 Like

So which MariaDB version should I use?

Sadly no idea. Have no experience with MariaDB.That would be more a question for a MariaDB forum or the mysql2 npm package which n8n is using underneath the hood.

Well, I upgraded mysql to version 10.1 (the lastest of plesk supported)
But connection still failed. I have a big issue of mysql connection.

When I use zapier, it connected all of mysql version easily.
(I used zapier for about 5 years)

I tried earlier today with version 8 as it seems to be the latest stable version.

Plesk can’t support v8. All my data 's in plesk now (last notice)

I have a big issue…

In this case, I doubt that you have MySQL 10 installed if they do not even support 8 yet. (not even sure v10 exists already).
I guess what it displays there is some kind of module and not the actual MySQL version.
Plesk is making a lot of problems for users the whole time. I advise you to simply get $5 droplet from Digital Ocean and install it there.