How to Connect to MySQL via SSH Tunnel in Windows

In this tutorial, I will let you know how to connect workbench or other tool with your live mysql server database. This is very helpful if you want to work on mysql server tool, for this you must have server credential as well as db credential.We will connect MySQL via SSH Tunnel in Windows with help of PUTTY.

We need following information to connect SSH tunnel with windows.

1- We need server IP.
2- Server credential with root access.
3- We need username,password and database name.

Simple Example of MySQL connection over SSH tunnel

There are following steps need to connect MySQL with ssh tunnel.

Step 1: First we will open putty and configure connection parameters in putty.

putty_session

We need to set server ip in hostname input filed and session name in saved session input field.

Step 2: Now we will gone through connection->SSH->tunnel option.

set_tunnels

Step 3: Added hostname in destination input option and port number in session port input field into tunnel.

save_tunnel_ap

Step 4: Click Apply button and now click open button on putty.

Step 5: Here we will login in putty as a root access user.
login-as

Now you have connected with your server, so next will be how to access server database with workbench. There are following steps need to follow.

Step 1: We will open workbench.
Step 2: We will click add new connection icon.
Step 3: Here we will fill connection name, Hostname and your server user name.
configure_connection_workbeanch

Step 4: click test connection button, if you will get parameters correct then its fine and you will get workbench dashboard.
Step 5:You need to click connection name which you have created above on workbench dashboard.
Step 6: He will ask password about mysql server put your server database password.

Please wait some moment and you will get mysql database dashboard.