Mysql – Cannot SSH tunnel with PuTTY (Windows Vista) to connect to MySQL on a Linux box

databaseMySQLputtyssh-tunnel

Goal:

I am trying to copy a database onto my local box running Windows Vista.

Setup:

  • Using MySQL 5.1 (mysql-essential-5.1win32) on Windows Vista
  • On Linux box: MySQL Ver 14.12 Distrib 5.0.51a,
  • I set up SSH tunneling on PuTTY this way:
    • Source port 3306, Destination:localhost:3307
    • I am using 3307, because I have my own database on Windows Vista running on 3306

I can locally log in to the database on my Linux box
however, when I tried to login from MySQL administrator using

  • Server Host: 127.0.0.1 Port 3307
  • username:someUser
  • password:somepassword

it failed with this message: MySQL Error Number 2003
Can't connect to MySQL server on 127,0.0.1 (10061)

How can I fix this?

Best Answer

It sounds like you've got it "backwards". The destination is not your loopback, it's the remote machine on the other network. That, or you're using Remote instead of Local for the tunnel.

Try flipping the IP addresses around, example:

putty.exe -L 3307:mysql.yourdomain.com:3306 

Where mysql.yourdomain.com is the name of the host that has the MySQL service you're trying to contact. When putty pops up the connection dialog, put in the address, connect, and log in. Then connect to localhost:3307 using the Administrator tool.