Bobcares

WeSupport

Call Us! 1-800-383-5193
Call Us! 1-800-383-5193
Call Us! 1-800-383-5193

Need Help?

Emergency Response Time custom

Our experts have had an average response time of 11.06 minutes in March 2021 to fix urgent issues.

We will keep your servers stable, secure and fast at all times for one fixed price.

“FATAL: no pg_hba.conf entry” – How to fix the PostgreSQL error

by | May 31, 2021

While connecting to PostgreSQL, users often notice the error “FATAL: no pg_hba.conf entry”.

As a part of our Server Management Service, we help our customers to fix PostgreSQL-related errors regularly.

Today, let us discuss the possible reasons and fixes for the error.


 

What is “FATAL: no pg_hba.conf entry” error

Connecting to PostgreSQL often triggers the error as shown below:

FATAL: no pg_hba.conf entry

This error generally triggers due to incomplete entries in the pg_hba.conf file. Generally, this configuration file controls the client authentication and is stored in the database cluster’s data directory.

The general format of the pg_hba.conf file contains a set of records, one per line. A record contains a number of fields separated by spaces and/or tabs. Fields can contain white space, but we need to quote the field value.

Each record specifies a connection type, a client IP address range, a database name, a user name, and the authentication method for connections matching these parameters.

Further, the first record with a matching connection type, client address, requested database, and user name is used to perform authentication. There is no “fall-through” or “backup”: if one record is chosen and the authentication fails, subsequent records are not considered. If no record matches, access is denied.
 

How to fix “FATAL: no pg_hba.conf entry” error

1. Log in to Postgres SQL server with the use of ssh console.

2. Now, move to the data directory with the cd command.

cd /var/lib/pgsql/9.6/data/

3. Then, open pg_hba.conf file in an editor.

vi pg_hba.conf

4. Add an entry of the host IP address from which we try to connect. We can input the entry of the host to which we would like to provide access to:

# TYPE  DATABASE    USER        CIDR-ADDRESS          METHOD
 
# IPv4 local connections:
host    all         all         127.0.0.1/32          md5
host    all  	    all  	xxx.xxx.xxx.xxx       md5
# IPv6 local connections:
host    all         all         ::1/128               md5

 

5. Then, restart the postgres SQL server.

systemctl restart postgresql-9.6.service

6. Try again in order to connect with the use of pgAdmin tool and we should be able to connect without any errors.

[Need help to fix PostgreSQL error? We are available 24*7]
 

Conclusion

In short, the “no pg_hba.conf entry” can happen due to missing entries in the configuration file. Today, we saw how our Support Engineers fix this error.

 

PREVENT YOUR SERVER FROM CRASHING!

Never again lose customers to poor server speed! Let us help you.

Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.

GET STARTED

var google_conversion_label = "owonCMyG5nEQ0aD71QM";

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

Privacy Preference Center

Necessary

Necessary cookies help make a website usable by enabling basic functions like page navigation and access to secure areas of the website. The website cannot function properly without these cookies.

PHPSESSID - Preserves user session state across page requests.

gdpr[consent_types] - Used to store user consents.

gdpr[allowed_cookies] - Used to store user allowed cookies.

PHPSESSID, gdpr[consent_types], gdpr[allowed_cookies]
PHPSESSID
WHMCSpKDlPzh2chML

Statistics

Statistic cookies help website owners to understand how visitors interact with websites by collecting and reporting information anonymously.

_ga - Preserves user session state across page requests.

_gat - Used by Google Analytics to throttle request rate

_gid - Registers a unique ID that is used to generate statistical data on how you use the website.

smartlookCookie - Used to collect user device and location information of the site visitors to improve the websites User Experience.

_ga, _gat, _gid
_ga, _gat, _gid
smartlookCookie

Marketing

Marketing cookies are used to track visitors across websites. The intention is to display ads that are relevant and engaging for the individual user and thereby more valuable for publishers and third party advertisers.

IDE - Used by Google DoubleClick to register and report the website user's actions after viewing or clicking one of the advertiser's ads with the purpose of measuring the efficacy of an ad and to present targeted ads to the user.

test_cookie - Used to check if the user's browser supports cookies.

1P_JAR - Google cookie. These cookies are used to collect website statistics and track conversion rates.

NID - Registers a unique ID that identifies a returning user's device. The ID is used for serving ads that are most relevant to the user.

DV - Google ad personalisation

IDE, test_cookie, 1P_JAR, NID, DV, NID
IDE, test_cookie
1P_JAR, NID, DV
NID
hblid

Security

These are essential site cookies, used by the google reCAPTCHA. These cookies use an unique identifier to verify if a visitor is human or a bot.

SID, APISID, HSID, NID, PREF
SID, APISID, HSID, NID, PREF