cc_staff
163
edits
(Marked this version for translation) |
No edit summary |
||
Line 190: | Line 190: | ||
<!--T:55--> | <!--T:55--> | ||
An SSH tunnel can be created from your desktop to database server, PostgreSQL or MySQL using the following command respectively: | |||
<!--T:47--> | <!--T:47--> | ||
<pre> | <pre> | ||
ssh | ssh -L PORT:cedar-pgsql-vm.int.cedar.computecanada.ca:5432 someuser@cedar.computecanada.ca | ||
ssh | ssh -L PORT:cedar-mysql-vm.int.cedar.computecanada.ca:3306 someuser@cedar.computecanada.ca | ||
</pre> | </pre> | ||
<!--T:48--> | <!--T:48--> | ||
These commands connect your localhost:PORT to | These commands connect your localhost:PORT to PostgreSQL or MySQL database server respectively. The port number you choose (PORT) should not be bigger than 32768 (2^15). "someuser" in this example is your Compute Canada username. The difference between this connection and an ordinary SSH connection is that you can now use another terminal to connect to the database server directly from your desktop. On your desktop run one of these commands, for PostgreSQL or MySQL as appropriate: | ||
<!--T:49--> | <!--T:49--> | ||
<pre> | <pre> | ||
psql -h 127.0.0.1 -P PORT -U <your username> - | psql -h 127.0.0.1 -P PORT -U <your username> -d <your database> | ||
mysql -h 127.0.0.1 -P PORT -u <your username> -p | mysql -h 127.0.0.1 -P PORT -u <your username> -p | ||
</pre> | </pre> | ||
<!--T:50--> | <!--T:50--> | ||
MySQL requires a password. The password is stored in your ".my.cnf" located in your home directory on Cedar. | |||
The database connection will remain open as long as the SSH connection remains open. | The database connection will remain open as long as the SSH connection remains open. | ||
</translate> | </translate> |