psql: error: FATAL: password authentication failed for user code example

Example 1: psql: FATAL: Ident authentication failed for user "postgres"

$ sudo -u postgres psql
\password
Enter password: ...
...

Example 2: password authentication failed for user postgres pgadmin

happened with me as well, when I started pgadmin3 for the first time, i was expecting it to ask for the password which I provided during but it didnt ask and then didnt display any servers.
anyways, you can create a server yourself,
if your server is on the same machine,
provide a name: test
provide server: localhost
port: 5432 (default port)
user: postgres (default user) you can change later in login roles
password: provide something

restart if required and it will then show you
database with postgres (default db),
tablespace,
login roles
under your server and you should be good to go

Tags:

Misc Example