MySQL Tools Comparison.

  • Increase font size
  • Default font size
  • Decrease font size
Home Articles SSH Create SSH tunnel for MySQL connections

Create SSH tunnel for MySQL connections

Print PDF
User Rating: / 78

Today we consider the organization of SSH tunneling through PUTTY to MySQL.

Some programs require a connection to the database MySQL. For example mysql.exe console or other tools to work with databases of online stores or websites.

Very often, in the application, which requires a connection to the database MySQL, there are only 5 fields:

  • Host
  • Port
  • Login
  • Password
  • Database

Some hosting providers allow direct access to the databases from outside, but others provide access to MySQL only through SSH protocol.

To build a SSH tunnel from your local machine to the database on the hosting, we recommend using PuTTY.

Next, write out step by step process.

  1. Download the PuTTY (you can download it from the developer website)
  2. Configure an SSH tunnel in PuTTY.
    2.1 In the category of Session
    The field "Host Name (or IP address)": write server ip or host (for example Amazon EC2:
    The field "Port": 22
    2.2 In the category "Connection - SSH - Tunnels"
    Under "Add new forwarded port" in the Source port: specify your local port, such as 3306 (we recommend this as it is a standard port of MySQL)
    The field "Destination": localhost:3306
    Choose item "Local" and "Auto"       Then click the button "Add" button.
    In the window "Forwarded Ports" should show our tunnel
    for example, "L3306 localhost: 3306."
    Then press the "Open" button.
    2.3 Enter the username and password of SSH user host.
    All done, SSH tunnel is ready!


Now open your application that requires access to the database MySQL, write:

Host: localhost

Login: Your login user database

Password: The password of the database user

Database: The database name

Port: 3306 (if required)

And press connect.


Good luck!


Add comment

Security code

HTTP-tunnel - Ability to manage MySQL database via the Internet. More...

'mysql.proc' doesn't exist fixed problem


Table 'mysql.proc' doesn't exist. Fix error 1146 Table doesn't exist here...