on our Linux server we have PostgreSQL DB
when we type –
psql -l
we get
psql: FATAL: no pg_hba.conf entry for host "[local]", user "root", database "postgres", SSL off
what we need to set in the /var/lib/pgsql/data/pg_hba.conf in order to fix this?
Best Answer
To list the databases, you can execute your command as
postgres
user:If you are already logged in as root, you can remove
sudo
from the above command. Userpostgres
is considered as root user for PostgreSQL database engine.The error shown in your post indicates that there is no access for user
root
fromlocalhost
to accesspostgres
database. So, you can editpg_hba.conf
file to include the desired login details like login name, DB name, and host. The file is well documented.For your case, you can add the following line to
pg_hba.conf
file:You need to reload your postgresql server after saving the changes.