I'm trying to develop a python application using Postgres. Unfortunately everytime I do a


I get this as an error:

OperationalError: (OperationalError) fe_sendauth: no password supplied None None

After playing around with the pg_hba.config file I still get the same error. The respective file is currently as follows:

# Database administrative login by Unix domain socket
local   all             postgres                                peer
local   all             alex                                    trust

# TYPE  DATABASE        USER            ADDRESS                 METHOD

# "local" is for Unix domain socket connections only
local   all             all                                     trust
# IPv4 local connections:
host    all             all               trust
# IPv6 local connections:
host    all             all             ::1/128                 trust
# Allow replication connections from localhost, by a user with the
# replication privilege.
#local   replication     postgres                                peer
#host    replication     postgres            md5
#host    replication     postgres        ::1/128                 md5

Would somebody be so kind as to help me with the right configuration for this file running on Ubuntu 14.04?


Pretty nice walk-through..... https://help.ubuntu.com/community/PostgreSQL

First find the file pg_hba.config. Usually found here:




Find this commented-out line:

# Database administrative login by Unix domain socket

And Underneath Change '???' to md5:

local   all             postgres               probably 'peer'


local   all             postgres                                md5

This is because Ubuntu uses md5 with postgres instead of peer authentication

Then run this command:

sudo /etc/init.d/postgresql reload

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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