The
Ultimate Connection Guide
TAU's MySQL
name/port: mysqlsrv.cs.tau.ac.il
Sakila schema
username/password: sakila/sakila
To connect to
a database you need to choose:
1. The
MySQL Server to connect to. This is usually either
1.a.
Local MySQL server you have installed on your computer. Useful for homework,
for testing your project locally.
1.b.
The school MySQL server on mysqlsrv.cs.tau.ac.il. Has sakila schema installed.
Useful for testing and submitting the final project. (Connection from home is
done via a tunnel, see below.)
2. The
MySQL Client to connect from. This is usually either
2.a.
MySQL Workbench tool installed on your computer / the computer lab (Schreiber
019)
2.c.
MySQL commandline tool on nova
2.d.
Your code, via jdbc MySQL connector
When you
open/configure/write the code of the client, provide the parameters of the
chosen server, as follows.
Connection |
User |
Password |
Host |
Port |
Comments (do not forget to…) |
From
home client to home server |
Your
user |
Your
password |
localhost
|
3306
|
1. Install
MySQL including server and Workbench |
Connect
from home client to TAU server |
TAU
MySQL user |
TAU
password |
localhost |
3305 |
1. Download
Putty 2. Create
TAU database account 3. Open
SSH tunnel first! |
Connect
from TAU lab to TAU server |
TAU
MySQL user |
TAU
password |
mysqlsrv.cs.tau.ac.il |
3306
(default) |
1. Create
TAU database account |
Each user
can open a personal account on the school server. Just follow the instructions
in the following link:
http://www.cs.tau.ac.il/system/MySQL
Note that
the initial password will be sent to you by mail. The page above also includes
instructions for changing this initial password.
Download
MySQL server + Workbench + jconnector: (see instructions in recitation #1)
http://www.mysql.com/downloads/mysql/
Download
Putty:
http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html
The idea
behind creating a tunnel is that your client would ‘think’ that the
server is at localhost:3305, but the tunnel established from your machine
(localhost) to nova.cs.tau.ac.il would redirect the requests to
mysqlsrv.cs.tau.ac.il:3306
How to do
that?
Run the
latest version of Putty (note that old versions might not connect, so download
the latest - this was done with 0.60) .
Set it to
point to Nova (nova.cs.tau.ac.il on port 22) by SSH
We now define
the tunnel:
Select
“Connection > SSH > Tunnels” from the category tree.
Enter
the following:
Source port: 3305 (or some other unused port on your localhost..)
Destination: mysqlsrv.cs.tau.ac.il:3306
Now hit the
“Add” button. Your screen should look something like this:
Now let us
just save the settings.. Go back to “Session” category, and your
preferred name (in the picture “TAU - MySQL Tunneling”) and click
save.
That is it! Do
not forget to actually connect to nova by entering your UNIX username and
password.
The following
image is for using MySQL Workbench with the tunnel: