Question

I am new to PostgreSQL and trying to configure it. After installing the PostgreSQL. I am trying to add a new connection to server using pgAdmin. I know there is a by default created on port 5432 but I change this port to 5433. And trying to configure all my database on this port. And through terminal this is working. enter image description here

But when I am trying to add a new connection to a server it throws

09:56:56: Error: Error connecting to the server: FATAL:  password authentication failed for user "tars"
FATAL:  password authentication failed for user "tars"

I have already followed this thread here. And also tried configuring pg_hba.conf. Changed this line

local   all             all                                     peer

to

local   all             all                                     md5

But couldn't add a new connection. This is the screenshot, the way I am trying to configure enter image description here

Can someone help me to create a new server ? And also help me to understand this little bit.

Was it helpful?

Solution

It seem like you are connection via termial to port 5432 as command psql on terminal directly connect to default port 5432

Try connecting to database via terminal using below

psql -p 5433

After connected, change user password

alter role tars with password 'tars'; --if role in not present create one with create role tar with superuser; 
alter role tars with login;

now go to pgadmin and change the following :

on maintenance db put "postgres"
on user put "tar"
on password put "tar"

and try connecting if still kindly lemme know the below things :

1) Can u list contents of pg_hba.conf and postgresql.conf file ?

2) Also how u changed port number via postgresql.conf or created another cluster ?

Licensed under: CC-BY-SA with attribution
Not affiliated with dba.stackexchange
scroll top