Connect to your PostgreSQL Server

by Amit Biswas Posted Feb. 13, 2017

Given your credentials via email, you can connect to your postgres server hosted on code.engineering.nyu.edu.

If you are home (read: not connected to NYU wifi) you have to use NYU VPN). Scroll down the page to see the download link for the vpn client for your platform (Windows, Mac etc.). When the vpn client asks for the server address use vpn.nyu.edu and use your typical netid and password to authenticate.

Accessing the Database locally using terminal

First SSH to code.engineering.nyu.edu

Once logged in type in the following command:

psql -p 55432 -U dbuser -d dbname

Change dbuser and dbname accordingly. You will be prompted for password to connect as well.

Once connected you will be dropped into psql shell. See some of the things you can do to manipulate your database here: psql guide.

Accessing the Database using a Client

There are several free PostgreSQL clients available of both Mac and Windows. Here is a short list:

I will be using pgAdmin 4 to demo how you can use a client to connect to your PostgreSQL database. Download and install the client using the links above. Open it up and you should see something like the following:

pgAdmin 4 Welcome UI
Figure 1. pgAdmin 4 start page.

Now add a new server.

pgAdmin 4 add server
Figure 2. pgAdmin 4 add server.

Fill the in details as described below. You should have received the dbname and password in an email.

pgAdmin 4 connection name
Figure 3. pgAdmin 4 server connection.

Make sure port is 55432.

pgAdmin 4 connection details
Figure 4. pgAdmin 4 server connection details.

If successful, pgAdmin 4 will show you the available databases on the server. Double click on the database assigned to you and you should be on your way. Expand schema, and play around with creating new tables and everything else there. See: PostgreSQL Documentation for more details about the database.

pgAdmin 4 database view
Figure 5. pgAdmin 4 database overview.

You should not be able to see/connect to other databases on the server. If you can, please send an email to cselabs-team@nyu.edu.