Error in importing sql file in postgres database :: psql: error: connection to server on socket "/var/run/postgresql/.s.PGSQL.5432" failed: FATAL: Peer authentication failed for user "postgres"
Error :: Very Important Error comes sometimes ::
psql: error: connection to server on socket "/var/run/postgresql/.s.PGSQL.5432" failed: FATAL: Peer authentication failed for user "postgres"
..................................................................................................................
Solution ::
1. check postgres cluster ::
$
2. check config name ::
$ ps -ef | grep postgres
$ sudo pg_ctlcluster 15 main start
$ sudo service postgresql restart
$ sudo nano /etc/postgresql/15/main/
$ sudo nano /etc/postgresql/15/main/pg_
three files comes ::
pg_ctl.conf pg_hba.conf pg_ident.conf
$ sudo nano /etc/postgresql/15/main/pg_hba.conf
$ sudo nano /etc/postgresql/15/main/pg_hba.conf
this above command will open the edit file at terminal
Now will come inside one diff file edit file --
here change peer to md5 here
after that start service postgresql by the below command ::
$ sudo service postgresql restart
after all above commands give command of sql file import ::
$ psql -U postgres hrms-finace < local_sql_file_02_12_22.sql


Comments
Post a Comment