Connecting Directly To The Development Database

From Warwick Student Cinema
Jump to: navigation, search

Here are some quick instructions for allowing your local machine to query the filmsoc database server through an SSH tunnel on Windows.

  1. Run PuTTY
  2. Enter the hostname as filmsoc.warwick.ac.uk
  3. Select Connection->Data
    1. Input your username in the "Auto-login username" field
  4. Select Connection->Auth
    1. Under "Private key file for authentication:", select a private key that the server will recognise (ie. one of the one's you use in pageant)
  5. Select Connection->SSH->Tunnels
    1. Under "Add new forwarded port:", type 3306 into "Source port"
    2. In the "Destination" field, type: database.filmsoc.warwick.ac.uk:3306
    3. Click "Add"
  6. Select Session
    1. Under "Saved Sessions" type "database" into the field and click "Save"
  7. Click "Cancel" to close PuTTY
  8. Now, open your favourite text editor and put the following on one line:
    1. "C:\Program Files\PuTTY\plink" database
      1. Note: Change the path to wherever PuTTY is installed!)
    2. Save the file as database.bat (or similar) and put it somewhere convenient (best in the PuTTY program directory)
  9. Create a shortcut to the batch file and place it in your start menu/quick launch/ desktop, wherever is convenient.
  10. Edit your hosts file to point database.filmsoc.warwick.ac.uk at the loopback interface (127.0.0.1). The hosts file is located at: C:\WINDOWS\System32\drivers\etc
    1. Just add a line like this: 127.0.0.1 database.filmsoc.warwick.ac.uk
    2. (This is so you don't have to modify the scripts when you've checked them out, nor do you have to change them back once you're done.)
    3. Note: On Vista or 7, the program editing the hosts file WILL need to be run as administrator, ie. you need to elevated it through UAC.
  11. Now, whenever you want to run the website locally, start up the batch script by activating the shortcut, and the website code should be able to access filmsoc's database server remotely.
  12. Be sure to close the Command Prompt once you are done, or type "quit" or "logout" at the SSH prompt

If something goes wrong, make sure that you have properly filled out all of the mentioned fields in PuTTY. If you miss anyone of them, plink will fail to launch properly. Make sure that your private key is not protected by a password.