I'm trying to use pgAdmin III to manage my Postgres database.

Here are the commands I've run on my machine:

sudo apt-get install postgresql

Then I installed the pgAdmin III application:

sudo apt-get install pgadmin3

Next I focused on setting my username and password in order to login:

sudo -u postgres psql postgres

Here I set my password
\password postgres

Finally I just created my database:

sudo -u postgres createdb repairsdatabase

When I try to login using pgAdmin III, I get the error:

An error has occurred:

Error connecting to the server: FATAL: Peer authentication failed for user "postgres"

enter image description here

  • 2
    How did you set up pg_hba.conf? Nov 28, 2012 at 2:17
  • I didn't set that configuration file at all, the Ubuntu wiki didn't mention it.
    – sergserg
    Nov 28, 2012 at 2:20
  • 1
    @Serg Please don't take this the wrong way, but if you're working with Postgres you really need to read the Postgres manual. Saying "The Ubuntu wiki didn't mention" a key aspect of Postgres setup and configuration is like saying "The manual for my Honda Civic didn't include instructions on starting the engines on this Boeing 777" (And that's leaving aside my personal feelings that Ubuntu's documentation is generally awful, whereas the Postgres manual is better than most commercial software I've used...)
    – voretaq7
    Nov 30, 2012 at 15:59

2 Answers 2


This is a bit of a FAQ.

You're connecting via UNIX sockets, and your pg_hba.conf is set to use peer authentication, so it expects your UNIX user ID to be the same as your PostgreSQL user ID.

Change pg_hba.conf to use md5 for local connections, and/or use TCP/IP by specifying "localhost" as the host instead of leaving the host blank. Local TCP/IP connections might be set to use ident in pg_hba.conf so change that to md5 if it is and if you want to use password auth.

See the PostgreSQL manual on pg_hba.conf for more information, and search Google for your error message.


I've had the same problem now.

It was solved by typing localhost to «Host» field at «New Server Registration» dialog.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .