Introduction Pricing and Billing FAQ Account FAQ Technical FAQ Tutorials Contact Us

Configuring pgadmin and Postgres

This tutorial explains how to set up pgadmin, a graphical client for Postgres databases. Pgadmin is available for free for Mac, Windows, and Linux.

Prerequisites and Background

No specific Postgres experience is required, though a general knowledge of how relational databases work is helpful.

This walkthrough uses a Postgres server run by Database Labs, but the same procedure can be used to connect to any Postgres server. You can provision a server from Database Labs in a few minutes by logging in, or you can run your own locally.

Understanding a few key terms will help:

Configuring pgadmin

When you start pgadmin, you'll see a window like this:

Click on the upper left button, the one that looks like an electrical plug. This tells the client to create a new database server connection. A dialog like this should show up:

Fill in the hostname, username, and password from the Database Labs information page:

When you click OK, you should get a window that looks like this:

This means that PGAdmin has connected to your database and is ready for you to control it.

Expanding the arrow control on the left, we can see that there is the system database named postgres. This special database contains various systemwide server settings. We'll create another database for ordinary usage.

Let’s create a user account, and a database for it to control. It's better to do ordinary work as a non-superuser with more limited privileges than the superuser "postgres" account, to lessen the chance of a security breach or user error. (For historical reasons, Postgres sometimes refers to user accounts as "roles". Users and roles are synonymous.)

Right-click on “Login Roles” under your database and choose “New Login Role”. (You can use any role name you like.)

Click the "Definition" tab and give the new role a password:

Looking at the last tab we can see the SQL queries generated by our entries in the previous tabs. This is what will actually be sent to the server when we click OK:

Click OK and it will submit the changes and create the user.

Now right-click on “Databases” and choose “New Database”:

Fill it out, making sure the user you just created is the owner of that database. This will let your new user control the database without giving them access to all parts of all databases. Make sure to check the generated SQL, then click OK:

Congratulations, you're now administering your Postgres server from pgadmin!