0

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.

1

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 ?

  • This is really a stupid thing from my side. All the configurations and settings were correct. It just I always forget to restart the postgresql after making any changes in that. That's why it was not reflecting any changes. Thank you @Ashiq for your time and answer. +1 – Lokesh May 29 '18 at 8:21
  • @Lokesh we learn from our mistake thats why we called as humans don't restart postgresql every time when u make changes only to variables like listen_address,port etc then only restart else reload will work – Ashiq Ahamed May 29 '18 at 8:37

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.