Is it possible to connect to the mysql server via ssh

pmr posted 11 years ago in Creating a connection
The server where MySQL resides does not have telnet running. Is it possible to connect HeidiSQL with ssh? I tried ssh tunnelling but cannot get it to work. Should ssh tunnelling work (meaning am I just thick and overlooked something) or is there another way to connect using ssh? I use HeidiSQL on on another server, and it works fine. I would like to continue to use it if possible. It is a great interface.
ansgar posted 11 years ago
I never tried HeidiSQL with SSH tunneling. And I never heard of anyone getting it to work. Maybe someone else has some fitting experiance and can tell us?
koter84 posted 11 years ago
I just tried to connect to my MySQL using putty.. It works great...

First download Putty (google on putty) then create a new connection.
Go to "Connection -> SSH -> Tunnels" in the left part of the screen and input the following:
Source port: 3306
Destination: localhost:3306
(The radiobuttons stay on "local" and "auto")
Then press the "Add" button.

Next open the connection and log in to the SSH-session.

Start up HeidiSQL and on the connection tab input the following:
Hostname/ip: localhost
enter user and password fields
port: 3306

then click save+connect and you're done.

if you've changed the server port MySQL listens on change the 3306 in this text to your value. Normally though port 3306 is used.

Good luck
pmr posted 11 years ago
Thanks for the help. I had to do one extra thing to get the tunnel to work. When setting up the tunnel, I had to check the box "Local ports accept connection from other host". Once that was checked, I was in and everything is working fine. Thanks
Pedja posted 10 years ago
I used MySQL Front with SSH fro years and now HeidiSQL. Works like a charm.

I can recommend SSHTunnelClient. That is great SSH program (based on putty), which simplifies settung up connection. It is free for noncomercial use (and fully functional).

However, I would like to see that HeidiSQl suports SSH internaly.
klondenberg posted 10 years ago
Should be easy enough using ssh from cygwin or one of the commandline tools from the putty distribution.

How it's done using putty has already been written, so I'll second this:

Using the ssh commandline tool, it is as easy as this:

ssh -L <local-port>:<db-hostname>:<remote-port> username@remote-server

and entering a password (unless you configured private key auth or use ssh-agent or something like that)

Usually the above line will look like this:

ssh -L 3306:localhost:3306 root@myserver.com

I have been using MySQL Front via SSH for ages as well, It's the only and best way to go to manage remote MySQL Servers.


ansgar posted 7 years ago
Just for those which didn't notice: Latest HeidiSQL builds have SSH tunnel functionality. Just tell Heidi where plink.exe is located, your user+pass and go for it:

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