0

I am running postgres on Ubuntu 22.04 and whenever I run psql -U postgres I get the error psql: error: connection to server on socket "/var/run/postgresql/.s.PGSQL.5432" failed: FATAL: password authentication failed for user "postgres" This is what my pg_lsclusters looks like 14 main 5432 online postgres /var/lib/postgresql/14/main /var/log/postgresql/postgresql-14-main.log

here is what the logs look like Connection matched pg_hba.conf line 90: "local all postgres md5" 2023-06-15 12:27:47.815 PDT [37614] postgres@postgres LOG: could not send data to client: Broken pipe 2023-06-15 12:27:50.834 PDT [37615] postgres@postgres FATAL: password authentication failed for user "postgres" 2023-06-15 12:27:50.834 PDT [37615] postgres@postgres DETAIL: User "postgres" has no password assigned I have tried changing back and fourth between peer and md5, so I'm not sure what the issue is.

  • Does the TCP socket yield the same issue? – Zazaeil Jun 15 '23 at 19:44
  • Yes, it appears to be listening this is what running netstat showed tcp 0 0 127.0.0.1:5432 0.0.0.0:* LISTEN – akaleonard Jun 15 '23 at 19:48
  • My question was: did you try to connect over a TCP socket rather than a Unix one? For that -h flag to be set to your host, probably to the localhost. – Zazaeil Jun 15 '23 at 20:09
  • Yes, I am configured to connect via unix socket and did try running it with the -h flag. Got the password authentication failed. Changing it to peer seems to still run me into peer authentication failed. – akaleonard Jun 15 '23 at 20:27
  • I did try switching it to a TCP socket too and it's telling me that `psql: error: connection to server on socket "/var/run/postgresql/.s.PGSQL.5432" failed: No such file or directory Is the server running locally and accepting connections on that socket? ` – akaleonard Jun 15 '23 at 20:38
  • Notice that the log message says that Unix socket is still being used, not a TCP socket. – Zazaeil Jun 15 '23 at 20:45

0 Answers0