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 11.111.111.111 I can then request access with;
~$ mysql -u User_Name -p -h xxxxxxxxxxxxxxx-1.rds.amazonaws.com

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 127.0.0.1:3336.
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?