Accessing MySQL database through SSH tunnel

63 Views Asked by At

At the moment I can access a MySQL database by SSHing in terminal. This prompts me for a passphrase for a key

ssh test-db01.somedomain.com

Enter passphrase for key '/Users/yourname/.ssh/path/to/key':

which I enter.

At this point I am in the remote host and can simply type

mysql

> SELECT * FROM users;
> ...

and mess around in the console.

This can be a bit cumbersome for me, and I want to connect up my SQL GUI (by tunnelling) so I can visualise all my records and stuff (I am using VSCode database tool), so it looks like this:

enter image description here

I have a bunch of config and keys corresponding to this host in my ~/.ssh folder.

The host I enter is the same one when I SSH in terminal.

That is, test-db01.somedomain.com.

As you can see I get a SSH error: getaddrinfo ENOTFOUND.

Any ideas what I can try here?

0

There are 0 best solutions below