Not able to connect to my PostgreSQL server on Linux after trying several methods [closed]

I’m having trouble connecting to the PostgreSQL server on my local machine (Linux Fedora). I gathered that this isn’t a Django/Python issue, but rather a specific PostgreSQL problem. I went through 3 different similar Stack Overflow questions, which strongly suggested changing the pg_hfa.conf file from ident to either true or md5 which I did in both cases. After this, I reloaded PostgreSQL server with the following in my Linux terminal sudo service postgresql restart This method did not work when I ran python manage.py migrate in my VS Code console and continue to get the error django.db.utils.OperationalError: connection to server at "localhost" (::1), port 5432 failed: FATAL: Ident authentication failed for user "postgres". Here is my pg_hfa.conf with the modifications I made # TYPE DATABASE USER ADDRESS METHOD # "local" is for Unix domain socket connections only local all all md5 # IPv4 local connections: host all all 127.0.0.1/32 md5 # IPv6 local connections: host all all ::1/128 md5 # Allow replication connections from localhost, by a user with the # replication privilege. # local replication all peer # host replication all 127.0.0.1/32 ident # host replication all ::1/128 ident This may be of some help, but here are the most recent logs for PostgreSQL ```2025-01-04 14:38:06.861 MST [8804] LOG: database system was interrupted; last known up at 2025-01-01 12:06:59 MST 2025-01-04 14:38:10.104 MST [8804] LOG: database system was not properly shut down; automatic recovery in progress 2025-01-04 14:38:10.113 MST [8804] LOG: redo starts at 0/37D8DA8 2025-01-04 14:38:10.113 MST [8804] LOG: invalid record length at 0/37D8DE0: expected at least 24, got 0 2025-01-04 14:38:10.113 MST [8804] LOG: redo done at 0/37D8DA8 system usage: CPU: user: 0.00 s, system: 0.00 s, elapsed: 0.00 s 2025-01-04 14:38:10.123 MST [8784] LOG: checkpoint starting: end-of-recovery immediate wait 2025-01-04 14:38:10.135 MST [8784] LOG: checkpoint complete: wrote 3 buffers (0.0%); 0 WAL file(s) added, 0 removed, 0 recycled; write=0.002 s, sync=0.002 s, total=0.014 s; sync files=2, longest=0.002 s, average=0.001 s; distance=0 kB, estimate=0 kB; lsn=0/37D8DE0, redo lsn=0/37D8DE0 2025-01-05 16:28:52.549 MST [8784] LOG: checkpoint starting: time 2025-01-05 16:28:53.928 MST [8784] LOG: checkpoint complete: wrote 12 buffers (0.1%); 0 WAL file(s) added, 0 removed, 0 recycled; write=1.344 s, sync=0.015 s, total=1.380 s; sync files=7, longest=0.005 s, average=0.003 s; distance=6 kB, estimate=6 kB; lsn=0/37DA750, redo lsn=0/37DA718``` The SO links to the similar problems are provided below. psql: FATAL: Ident authentication failed for user "postgres" Getting error: Peer authentication failed for user "postgres", when trying to get pgsql working with rails PostgreSQL - FATAL: Ident authentication failed for user This isn't related and I'm not sure if this will help, but I did manage to save all my PostgreSQL, Solr, Ngnix, dumped my database on to a USB drive before I dual booted to Linux Fedora. I'm new to Linux, but maybe I can somehow get my PostgreSQL, Solr, Ngnix programs running from my flash drive as a workaround to this issue. Please I need some kind of guidance, I’ve been stuck on this particular issue for days now and examined several other similar problems via Googling Stack Overflow.

Jan 15, 2025 - 06:11
Not able to connect to my PostgreSQL server on Linux after trying several methods [closed]

I’m having trouble connecting to the PostgreSQL server on my local machine (Linux Fedora). I gathered that this isn’t a Django/Python issue, but rather a specific PostgreSQL problem.

I went through 3 different similar Stack Overflow questions, which strongly suggested changing the pg_hfa.conf file from ident to either true or md5 which I did in both cases. After this, I reloaded PostgreSQL server with the following in my Linux terminal sudo service postgresql restart

This method did not work when I ran python manage.py migrate in my VS Code console and continue to get the error django.db.utils.OperationalError: connection to server at "localhost" (::1), port 5432 failed: FATAL: Ident authentication failed for user "postgres".

Here is my pg_hfa.conf with the modifications I made

# TYPE  DATABASE        USER            ADDRESS                 METHOD

# "local" is for Unix domain socket connections only
local   all             all                                     md5
# IPv4 local connections:
host    all             all             127.0.0.1/32            md5
# IPv6 local connections:
host    all             all             ::1/128                 md5
# Allow replication connections from localhost, by a user with the
# replication privilege.
# local   replication     all                                   peer 
# host    replication     all             127.0.0.1/32          ident   
# host    replication     all             ::1/128               ident


This may be of some help, but here are the most recent logs for PostgreSQL
```2025-01-04 14:38:06.861 MST [8804] LOG:  database system was interrupted; last known up at 2025-01-01 12:06:59 MST
2025-01-04 14:38:10.104 MST [8804] LOG:  database system was not properly shut down; automatic recovery in progress
2025-01-04 14:38:10.113 MST [8804] LOG:  redo starts at 0/37D8DA8
2025-01-04 14:38:10.113 MST [8804] LOG:  invalid record length at 0/37D8DE0: expected at least 24, got 0
2025-01-04 14:38:10.113 MST [8804] LOG:  redo done at 0/37D8DA8 system usage: CPU: user: 0.00 s, system: 0.00 s, elapsed: 0.00 s
2025-01-04 14:38:10.123 MST [8784] LOG:  checkpoint starting: end-of-recovery immediate wait
2025-01-04 14:38:10.135 MST [8784] LOG:  checkpoint complete: wrote 3 buffers (0.0%); 0 WAL file(s) added, 0 removed, 0 recycled; write=0.002 s, sync=0.002 s, total=0.014 s; sync files=2, longest=0.002 s, average=0.001 s; distance=0 kB, estimate=0 kB; lsn=0/37D8DE0, redo lsn=0/37D8DE0
2025-01-05 16:28:52.549 MST [8784] LOG:  checkpoint starting: time
2025-01-05 16:28:53.928 MST [8784] LOG:  checkpoint complete: wrote 12 buffers (0.1%); 0 WAL file(s) added, 0 removed, 0 recycled; write=1.344 s, sync=0.015 s, total=1.380 s; sync files=7, longest=0.005 s, average=0.003 s; distance=6 kB, estimate=6 kB; lsn=0/37DA750, redo lsn=0/37DA718```

The SO links to the similar problems are provided below.

psql: FATAL: Ident authentication failed for user "postgres"

Getting error: Peer authentication failed for user "postgres", when trying to get pgsql working with rails

PostgreSQL - FATAL: Ident authentication failed for user

This isn't related and I'm not sure if this will help, but I did manage to save all my PostgreSQL, Solr, Ngnix, dumped my database on to a USB drive before I dual booted to Linux Fedora. I'm new to Linux, but maybe I can somehow get my PostgreSQL, Solr, Ngnix programs running from my flash drive as a workaround to this issue.

Please I need some kind of guidance, I’ve been stuck on this particular issue for days now and examined several other similar problems via Googling Stack Overflow.