cc_staff
163
edits
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 == | ||
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 | 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 | 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. |