ssh tunneling

How to connect to MySQL on mysql-cspp.cs.uchicago.edu from OS-X or Linux

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.

  • Open a Terminal (Applications => Utilities => Terminal)
  • Enter the next line, substituting your CS username:
  • ssh -fNL 3307:mysql-cspp.cs.uchicago.edu:3306 your-cs-username@classes.cs.uchicago.edu
  • It should ask for your CS password, then simply exit.

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:
  • telnet 127.0.0.1 3307
If you get Connection refused., the tunnel is probably not in place.
Make sure you have network access, then try the above ssh command again.

If you get Connected to 127.0.0.1...Bad Handshake Connection closed by foreign host. the 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.