0

I'm running macOS Monterey version 12.2.

After restarting my laptop I can no longer connect to my postgresql server. and am getting this error:

(base) user@user Application Support % brew services restart postgresql
Stopping `postgresql`... (might take a while)
==> Successfully stopped `postgresql` (label: homebrew.mxcl.postgresql)
==> Successfully started `postgresql` (label: homebrew.mxcl.postgresql)
(base) user@user Application Support % psql postgres
psql: error: connection to server on socket "/tmp/.s.PGSQL.5432" failed: No such file or directory
    Is the server running locally and accepting connections on that socket?

I found may suggestions online such as here to remove postmaster.pid. I could not find postmaster.pid in the suggested path (/usr/local/var/postgres/postmaster.pid) however I did find a postmaster.pidunder /usr/local/var/postgres.backup/postmaster.pid which I then removed. but I am still getting the same error.

Can anyone help me with this? And can anyone help clarify why I had no /usr/local/var/postgres/postmaster.pid but did have a /usr/local/var/postgres.backup/postmaster.pid?

pd441
  • 2,644
  • 9
  • 30
  • 41

1 Answers1

0

I had the same problem today. Postgres stopped working after restarting my computer. If you use brew, you can try brew services restart postgresql but that did not work either.

These commands work for me:

pg_ctl -D /usr/local/var/postgres stop

Then start

pg_ctl -D /usr/local/var/postgres start

You can also check status with pg_ctl -D /usr/local/var/postgres status

chris
  • 2,490
  • 4
  • 32
  • 56