Ads were blocked by your webbrowser.

This is not a problem, but keep in mind that developing HeidiSQL, user support and hosting takes time and money.

You may want to send a donation instead.

SSH Tunnel > DB host is not localhost

4dventurist's profile image 4dventurist posted 6 months ago in General

Hi,

This seems to only work if MySQL is reachable at localhost once you SSH in. What if it isn't?

I've tried putting the DB host under Settings > Hostname but that doesn't work for me.

The part of plink.exe that it changes is:

-N -L 3307:<my db hostname here>:3306

Doesn't this have to be localhost? Sorry I'm a little confused on what the -L option does.

Thanks for any help.

Rob

4dventurist's profile image 4dventurist posted 6 months ago

Maybe I made no sense in my previous post... so here goes again.

Normally this is how I could connect to MySQL on a shared hosting plan

--

My computer --> SSH --> Shared host --> MySQL available on localhost

My scenario with 1 & 1 hosting

My computer --> SSH --> Shared host --> MySQL is only available at db.host.io

--

Will SSH Tunnel work with the later scenario?

ansgar's profile image ansgar posted 6 months ago

From plink.exe output:

-L [listen-IP:]listen-port:host:port
           Forward local port to remote address

You have to enter the remote host in the "SSH tunnel" tab of HeidiSQL. This is what is used between the listen-port: and :port.

Once the tunnel to the remote host is established, HeidiSQL has a hardcoded address of "127.0.0.1" to which it connects.



Ads were blocked by your webbrowser.

This is not a problem, but keep in mind that developing HeidiSQL, user support and hosting takes time and money.

You may want to send a donation instead.
4dventurist's profile image 4dventurist posted 6 months ago

OK I think I figured out the problem

On the server in /etc/ssh/sshd_config the following option is set

AllowTcpForwarding no

--

I tried it manually from the command line, then manually did a telnet to 127.0.0.1:3307 and look what happens (see attached)

1 attachment(s):
  • problem
ansgar's profile image ansgar posted 6 months ago

So, if you allow AllowTcpForwarding, then tunneling works?

4dventurist's profile image 4dventurist posted 6 months ago

unfortunately it's a server setting for sshd so I can't change it, but I believe if I could then it would work.

ansgar's profile image ansgar posted 6 months ago

Oh shit.

In that case I have no clue how to use Heidi then.

Please login to leave a reply, or register at first.