pgadmin gives me the error: no password supplied

DarkCoffee picture DarkCoffee · Dec 26, 2012 · Viewed 58.6k times · Source

I've installed postgresql 9.2 on linux (kubuntu) and the last version of pgadmin3, but when I connect them I have this error:

An error has occurred: Error connecting to the server: fe_sendauth: no password supplied

What can I do?

I have also configured tomcat for my web application in java. In fact, postgresql was working before trying my application.

Answer

Erwin Brandstetter picture Erwin Brandstetter · Dec 26, 2012

Whether a password is required depends on your settings in pg_hba.conf. And there are different ways you can connect - different settings in pg_hba.conf may apply.

I quote the help shipped with pgAdmin 3 for the "Host" field in the connection ("server") settings:

The host is the IP address of the machine to contact, or the fully qualified domain name. On Unix based systems, the address field may be left blank to use the default PostgreSQL Unix Domain Socket on the local machine, or be set to an alternate path containing a PostgreSQL socket. If a path is entered, it must begin with a “/”. The port number may also be specified.

If you connect via Unix socket the rules for "local" apply. Whereas when connecting via TCP/IP "host" (or "hostssl") rules applies.

If you have a line like this at the top your pg_hba.conf file:

local    all     all     peer

or:

local    all     all     ident

.. then you can connect locally without password if your system user is "postgres" and your database user is "postgres", too.