Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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

share|improve this question
2  
How did you set up pg_hba.conf? –  Michael Hampton Nov 28 '12 at 2:17
    
I didn't set that configuration file at all, the Ubuntu wiki didn't mention it. –  Serg Nov 28 '12 at 2:20
    
@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 '12 at 15:59
add comment

1 Answer

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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.