This is an old revision of the document!
If you are off-campus (or on the wireless network), you will need VPN.
Not to be confused with DB1, this only needs a simple SSH command to connect (open a terminal):
ssh <yourusername>@shahlab-dev2.stanford.edu
The first time you do this it will ask you to store the RSA key, just type yes. After the first time, this should not appear anymore.
There are multiple different ways of connecting to the database server. If you are off-campus, you will need VPN.
NOTE: Your DB1 password is NOT the same as your dev2 password. It is found on the .my.cnf file file on your home/your_name directories.
1) (The easiest way) Set up a MySQL GUI:
There are plenty of options to use, but we recommend:
Example: setting up MySQL workbench with tunneling
2) (Second easiest way) From the command line :
- SSH to dev2
- Use Mysql:
mysql -h localhost -P 3306 -u<yourusername> -p<yourpassword> <databasename>
3) (hard and confusing) Create a tunnel from the database server to your computer:
- To connect to shahlab-db1.stanford.edu, a MySQL database (port 3306), tunnel via shahlab-dev2.stanford.edu.
ssh -L 3306:shahlab-db1.stanford.edu:3306 <yourusername>@shahlab-dev2.stanford.edu -Nf
- Use your local copy of MySQL (you need to instal the MySQL client on your computer)
- Then connect to the database of interest
mysql -h localhost -P 3306 -u<yourusername> -p<yourpassword> <databasename>