[Solved] Could not connect to PostgreSQL. FATAL: no pg_hba.conf entry for host
Overview:
While trying to configure PostgreSQL, we faced this:
Error:
Could not connect to Source DBMS.
OperationalError("('08001', '[08001] FATAL: no
pg_hba.conf entry for host "1xx.xxx.xx.xxx", user
“username”, database "db", SSL off\n (101)
(SQLDriverConnect)’)"): error calling Python module
function DbPostgresqIRE.connect
Reason:
You face this fatal error (Could not connect to PostgreSQL. FATAL: no pg_hba.conf entry for host) because the firewall is not giving access to your specified IP address.
What is pg_hba.conf file?
A configuration file, often called pg_hba.conf and kept in the database cluster's data directory, regulates client authentication. Host-based authentication is referred to as HBA. When initdb initializes the data directory, a default pg hba.conf file is set up.
Where is pg_hba.conf?
It is found in the path as follows: /etc/postgresql/12/main.
Solution:
Go to pg_hba.conf file in the above location and add the following line at the end:
host all all 0.0.0.0/0 md5
It allows access to all databases for all users.
Restart Postgresql by writing this command:
$ service postgresql restart
See you next time.
@TechAE
No comments:
Post a Comment
Thank you for submitting your comment! We appreciate your feedback and will review it as soon as possible. Please note that all comments are moderated and may take some time to appear on the site. We ask that you please keep your comments respectful and refrain from using offensive language or making personal attacks. Thank you for contributing to the conversation!