ssh tunneling

How to connect to MySQL on mysql-cspp.cs.uchicago.edu from Windows XP

This is how to establish a ssh tunnel to MySQL on mysql-cspp.cs.uchicago.edu
A tunnel allows you to connect to our MySQL server from a laptop or other machine that is outside the cs.uchicago.edu domain. It "tunnels" you through our firewall.

Download putty

Run Putty

Host Name: classes.cs.uchicago.edu Port: 22
Protocol: SSH
Don't yet click OPEN

Under Category, under ssh, click Tunnels

  • Source Port: 3307
  • Destination: mysql-cspp.cs.uchicago.edu:3306 (note the colon)
  • Local and Auto should be selected.
  • Click [Add]
Under Category, click Session
  • Under Saved Sessions, name this session, for example:
  • MySQL CS mysql-cspp tunnel
  • Click [Save]
Now, to establish a tunnel, click MySQL CS mysql-cspp tunnel
then click [Open]
login as: your-cs-username and password
This will give you a standard terminal window on classes.cs.uchicago.edu

Next time you need to establish a tunnel, just run putty, then click on MySQL CS mysql-cspp tunnel and open

Connecting to MySQL on mysql-cspp

As long as this terminal is active (it can be minimized), you should be able to connect to mysql-cspp.cs from other programs running on your machine. The only difference is instead of connecting via mysql-cspp.cs.uchicago.edu, connect via 127.0.0.1 using port 3307

Debugging

Try telneting to the port on your local machine:
  • start => accessories => command prompt
  • telnet 127.0.0.1 3307
If you see a message like:
could not open connection to the host on port 3307
the tunnel is probably not in place.
Make sure you have network access, and check your putty settings.

If a window opens with some messages, including bad handshake and Connection to host lost. then your tunnel is ok. Focus on the software you are trying to make the connection with. Be sure to use 127.0.0.1 instead of mysql-cspp.cs.uchicago.edu and use port 3307.