1

Hi I'm trying to use PuTTY to open a SSH tunnel and connect to a remote MySQL server.

PuTTY:

  1. Remote SSH Server IP and port

  2. MySQL Port on the remote server

  3. Tunnel: Local address and port on local machine (I have MySQL Server installed locally, so I'm using 3307 and not 3306 on local machine so there is no conflict with local MySQL Server)

enter image description here enter image description here

Si I click open, PuTTY asks for an username and password which I provide, if the logon is successful PuTTY immediately closes itself with out any messages or errors

putty.log shows this:

=~=~=~=~=~=~=~=~=~=~=~= PuTTY log 2017.08.23 07:29:08 =~=~=~=~=~=~=~=~=~=~=~=

login as: myUser
Using keyboard-interactive authentication.
Password for myUser@Server:
Could not chdir to home directory /home/myUser: No such file or directory
This service allows sftp connections only.

Now, If I try to connect with MySQL Workbench using the option Standard TCP/IP over SSH, it works...

enter image description here

I've read in forums that the solution is to tweak the options on the SSH server, but I don't have any control over the SSH Server.

Although I can use WorkBench to connect to the database, the goal here, is to have Putty open the SSH tunnel.

How can I open the SSH tunnel with PuTTY? What am I doing wrong? How can I solve this without altering the server?


Using plink: getting the same result

enter image description here


EDIT

I disabled the Don't start a shell or command at all option as Martin suggested, now I don't receive the SFTP error, but after typing the password nothing happens

The log is just writing what I see in the screen:

=~=~=~=~=~=~=~=~=~=~=~= PuTTY log 2017.08.23 10:07:25 =~=~=~=~=~=~=~=~=~=~=~=
login as: user
Using keyboard-interactive authentication.
Password for user@server:

EDIT 2 - SOLVED

After following Martin Prikryl advice:

I swapped the ports: L3307 -> 127.0.0.1:3306

enter image description here

Putty event Log now says: Access granted - Local port 3307 forwarding to 127.0.0.1:3306

Now MySQL WorkBench is able to connect to 127.0.0.1:3307 successfully

Thanks!

In case you need to do this with PLINK, here is how I did it:

plink.exe SSH_SERVER_IP_OR_ADDRESS -P 2204 -ssh -l USER -pw PASSWORD -L 3307:127.0.0.1:3306 -N -v
  • You have 2 and 3 labeled other way around. – Martin Prikryl Aug 23 '17 at 14:35
1

Try checking:
Connection > SSH > Protocol options > Don't start a shell or command at all.


You also have a local and remote port of the tunnel swapped.

It should be:

L3307 => 127.0.0.1:3306
  • I'm not receiving the SFTP error anymore, but after typing the password nothing happens – The One Aug 23 '17 at 14:46
  • Sounds good to me. What did you expect to happen? It just opened a tunnel (check PuTTY event log). Now you need to connect to the tunnel. – Martin Prikryl Aug 23 '17 at 14:50
  • Actually I might have not understood the question. What do you want to do with the tunnel? Why do you create a tunnel, if the workbench can create its own? – Martin Prikryl Aug 23 '17 at 14:51
  • I was expecting a confirmation like "Connection succesful" or something – The One Aug 23 '17 at 14:53
  • 1
    I have asked for PuTTY event log, not session log. Right click PuTTY console window title and select "Event log". – Martin Prikryl Aug 23 '17 at 15:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.