Error when trying to connect over SSH tunnel

[expired user #6440]'s profile image [expired user #6440] posted 12 years ago in General Permalink
Hi,

I'm having the same kind of problem (I think) as was described there: SQL Error (2003): Can't connect to MySQL server on 'localhost' (10061).

Here's my setup:
- running HeidiSQL 7.0.0.4157 at home (H)
- running a MySQL server on server A
- I want to connect with an SSH tunnel on server B, like:
H --SSH--> B ----> A

A is configured to accept connection from B's IP.
B is configured to accept tunnels (actually, I'm running a bidirectional SSH tunnel on it 24/7 for other stuff)

But when I try to connect to the MySQL server, I get the above-mentioned error message. Full log:
/* Connecting to 188.*.*.* via MySQL (SSH tunnel), username ******, using password: Yes ... */
/* Attempt to create plink.exe process, waiting 4s for response ... */
/* SQL Error (2003): Can't connect to MySQL server on 'localhost' (10061) */
/* Closing plink.exe process #2244 ... */


Any idea about what I could be doing wrong ?

Thanks
jfalch's profile image jfalch posted 12 years ago Permalink
tunneling is not by itself transitive. ie plink creates a tunnel from H:3306 to B:3306, and AFAIK the tunnel ends there. What program or configuration will create another tunnel from B:3306 to A:3306 ?
if you want this to be automatic, you could try to insert A´s ip address, NOT localhost, in hostname/ip field of 'settings' tab of heidisql´s session manager for this connection, while 'ssh host+port' in 'ssh tunnel' tab contains the name/address of B.
[expired user #6440]'s profile image [expired user #6440] posted 12 years ago Permalink
"What program or configuration will create another tunnel from B:3306 to A:3306?"
=> no tunnel there (this connection I trust, unlike H-->B), I simply ask Heidi to connect to A after going to B via the tunnel.

"if you want this to be automatic, you could try to insert A´s ip address, NOT localhost, in hostname/ip field of 'settings' tab of heidisql´s session manager for this connection, while 'ssh host+port' in 'ssh tunnel' tab contains the name/address of B"
That's what I did (which is why I find the mention of "localhost" in the error message quite puzzling):
- Setings->Hostname/IP = IP of server A
- SSH tunnel->SSH host + port = IP of server B:22
Looks indeed like Heidi doesn't follow what's put the the first field, but instead goes to B then tries to connect locally... Bug or design? (but then I suppose the "Setings->Hostname/IP" field should be disabled if it's meant to be ignored)
[expired user #6440]'s profile image [expired user #6440] posted 12 years ago Permalink
"this connection I trust, unlike H-->B"
=> or more precisely, H-->X (no edit button?)
[expired user #6440]'s profile image [expired user #6440] posted 12 years ago Permalink
I just tried doing H --ssh--> A ----> A, and this works. So Heidi does ignore "Setings->Hostname/IP" in the case of an SSH tunnel.unhappy

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