Error: FATAL: no pg_hba.conf entry for host - PostgreSQL - pg_hba.conf is empty
-
05-02-2021 - |
Question
I upgraded the PostgreSQL database from version 10 to 11. As I tried to access the database from a client pgadmin4 console, I got the below error:
I checked the two file postgresql.conf and pg_hba.conf in the system. However, when I tried to open the pg_hba.conf file, it comes up blank. I followed the steps for the upgrade (for Ubuntu users)in the link below:
I know this error might get resolved if I allow privileges in the pg_hba.conf file. But that file does not show any data in it. I am a beginner in setting up database servers and could have unknowingly skipped something which I cannot figure out. Can anyone please help me with this?
Adding the image for pg_hba.conf file:
Solution
Upgrading a database with either dump/restore or pg_upgrade
will not copy the configuration files, so you are left with whatever pg_hba.conf
was there right after initdb
created the new cluster.
You have to edit and adapt postgresql.conf
and pg_hba.conf
and other configuration files you use manually on the new cluster. With pg_hba.conf
copying the file over is usually good enough, but postgresql.conf
requires more attention.