SSH tunnelling: Difference between revisions

Jump to navigation Jump to search
no edit summary
No edit summary
No edit summary
Line 168: Line 168:


== Example for connecting to a database server on cedar from a desktop ==
== Example for connecting to a database server on cedar from a desktop ==
The command to connect to PostgreSQL and MySQL respectively are
Commands to connect to PostgreSQL and MySQL respectively are:
<pre>  
<pre>  
ssh -2 -L 127.0.0.1:PORT:cedar-pgsql-vm.int.cedar.computecanada.ca:5432
ssh -2 -L 127.0.0.1:PORT:cedar-pgsql-vm.int.cedar.computecanada.ca:5432
Line 174: Line 174:
</pre>
</pre>


By running one of these commands you will be connected to cedar (like any other ssh connection). The only difference between this connection and other ssh connection is that you can now use another xterm  and connect to database server directly from your desktop. Here is the command for PostgreSQL and MySQL respectively:
By running one of these commands you will be connected to cedar (like any other ssh connection). The only difference between this connection and an ordinary ssh connection is that you can now use another terminal and connect to database server directly from your desktop. Here are commands for PostgreSQL and MySQL connection respectively:


<pre>  
<pre>  
psql -h 127.0.0.1 -P PORT -U <your username> -W
psql -h 127.0.0.1 -P PORT -U <your username> -W
mysql -h 127.0.0.1 -P PORT -p
mysql -h 127.0.0.1 -P PORT -u <your username> -p
</pre>
</pre>


The connection requires a password for both MySQL and PostgreSQL. However, for PostgreSQL the password is your computecanada password and for MySQL the password is stored in a file called .my.cnf located in your home directory of cedar. The connections will remain open as long as your have your above ssh connection. In this example "PORT" is a arbitrary port number and it should be opened in firewall of cedar head node. So, please before running this command send a request to support@computecanada.ca and we will assign a port number for you.
The connection requires a password for both MySQL and PostgreSQL. However, for PostgreSQL the password is your computecanada password and for MySQL the password is stored in your ".my.cnf" located in your home directory on cedar. The connections will remain open as long as your have your above ssh connection. In this example "PORT" is an arbitrary number and it should be opened in firewall of cedar head node. So, please before running this command send a request to support@computecanada.ca and we will assign a port number for you.
cc_staff
163

edits

Navigation menu