ben tedder : code things

Use pgAdmin to access a postgres database from within a Vagrant box

I have a Vagrant box (Ubuntu) setup with postgresql. I want to access my database from my local machine using pgAdmin. Here's how I did it:

First, navigate to your postgres directory: cd /etc/postgresql/9.3/main

Next, edit your pghba.conf (`nano pghba.conf`). On the last line, create a new row with the following 5 columns:

host all all all password

Finally, make sure your postgresql.conf (in the same directory) has the following line:

listen_addresses = '*'

From within pgAdmin, create a new connection. Put the IP of your Vagrant box and the port (usually 5432). Also, put the username and password of your user.

Tip: if you don't have a user, or dont' know what it is, you can always create a new superuser with a password with this command: createuser -P -s -e usernamegoeshere