Access MySQL through SSH

Hi, I am having issues accessing MySQL through n8n.
I looked through the forum for someone with similar issues as it could be my lack of skills.
I can access it through the terminal but for some reason it doesn’t work on n8n.

I first open the SSH session

Here is how I access MySQL through the terminal;

I have copy pasted all the credentials so their are identical in n8n, I then point it to the 3336 port I connected in the SSH session.

When I try to run a query I get connection time out.

Does anyone know the issue?
Thanks for all the help!

So I understand it correctly that you create an SSH tunnel and so redirect the local traffic to the remote MySQL server? In this case should the “Host” in the credentials not be “localhost”?

1 Like

The MySQL host is different from the SSH host.
I first connect to an SSH IP e.g [email protected] once I have access to I can then request access with;
~$ mysql -u User_Name -p -h

This is how I access it through Sequel Pro

Honestly do not have much experience in this. But what an SSH tunnel does is to redirect all local traffic from a local port to another or the same port of an external server.

So as described here:

And there it then also says to connect now to
If there are totally different servers and if sending traffic to the port of the SSH server does not end up on the MySQL server I honestly do not know how to connect to it. Again have sadly no experience. But is also not a directly to n8n related question, rather a more generic one. So I guess if you do some more googling you find a solution that would also work with n8n.

Thanks Jan, fully understandable. I was most curious about the Mysql node on n8n. Perhaps the issue is there on how it forwards its requests and perhaps one could add the SSH tunneling in like Sequel pro to make it easier.

I found the solution. Is it a possible to work with the ssh2 node mentioned here together with n8n?

I’m looking for this feature too, because for run remote commands such as mysql querys in another host is secure regarding access another environment to use some workflows.

In my case I`m creating workflow to access management, using JIRA Service Desk as input, to give access creating users in MYSQL instance and give access in databases.

Did someone manage to get this working. I am currently looking for a solution to this problem as well. Would need to be able to connect to our MySQL server over a SSH connection.

Change this post to a feature request. You can now upvote it. The more votes, the more chances of being developed.

1 Like