WARNING server login failed: FATAL no pg_hba.conf entry for host “”, user “postgres”, database “postgres”, SSL off1 min read

We need your support!!
Other Amount:
techrunnr.com:
24-Hour Flash Sale. Courses from just ₹ 490.
Prabhin Prabharkaran Administrator
DevOps Engineer

He is a Technical professional. He is a person who loves to share tricks and tips on the Internet. He Posts what he does!

follow me

I have an application that uses Postgres as the database to store application-related data. During my initial setup, I have found the above error in the application while connecting the database.

WARNING server login failed: FATAL no pg_hba.conf entry for host "10.244.1.94", user "postgres", database "postgres", SSL off

From the above error, we can clearly understand that Postgres is not accepting any connection from 10.244.1.94 IP address. As you know Postgres has host-based access control which accepts the database connection from the listed host.

In order to solve this error, we need to add an entry in the pg_hba.conf ( which is the host-based access control file which is located in the Postgres data folder) which is by default located at /var/lib/postgres/data/dbfiles location. Note that this location may get changed if you have any custom data location.

Once you identify the location open the file and add the below entry, where it allows access to all databases for all users with encrypted password.

host all all 0.0.0.0/0 md5

Note that you can change 0.0.0.0/0 to network mask where you application is trying to connect. In my case Im using 0.0.0.0/0.

And add the below line in postgres.conf

listen_addresses = '*'

Once you do all the changes do restart for the Postgres or timescaleDB service.

Service postgres restart

Cheers !!!!

Happy learning

We need your support!!
Other Amount:
techrunnr.com:
#1
#2
#3
Questions Answered
Articles Written
Overall Points

Prabhin Prabharkaran

He is Technical professional. He is a person who loves to share tricks and tips on the Internet. He Posts what he does!!

You may also like...

Leave a Reply