Database Administrators Asked by Lloyd Thomas on January 23, 2021
I am using PostgreSQL12 on Cent0S8, and I am able to connect to PostgreSQL using the command:
sudo -u postgres psql
However, when I attempt to connect using:
psql -U postgres -h localhost
I recieve the following error:
psql: error: count not connect to server: FATAL: Ident authentication failed for user "postgres"
Every option is set to trust
within my pg_hba.conf
file, and I successfully restarted the server after making these changes.
Does anyone know of what I would need to change to be able to login using the psql -U postgres -h localhost
command?
If you are editing wrong hba file this should fix
psql
should be connected to PostgreSQLshow hba_file;
should be seeing to correct hba_file directory and edit that file.lloyd@localhost:~$ sudo su - postgres
postgres@localhost:~$ psql
psql (13.1 (Ubuntu 13.1-1.pgdg18.04+1), server 12.5 (Ubuntu 12.5-1.pgdg18.04+1)) Type "help" for help.
postgres=# show hba_file ;
hba_file
/etc/postgresql/12/main/pg_hba.conf (1 row)
postgres=# select pg_reload_conf();
Last query should return true if it's not, there is an error in hba file so PostgreSQL won't refresh hba file. So you should look for error in file. Also you can look at logs. After reloading PostgreSQL, it shows you error with line.
Correct answer by Yavuz Selim on January 23, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP