我使用的是macOS Monterey 12.2版本
重新启动笔记本电脑后,我不能再连接到我的postgresql服务器。我得到这个错误:
(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?
我在网上找到了一些建议,比如这里删除postmaster.pid
。我在建议的路径(/usr/local/var/postgres/postmaster.pid
)中找不到postmaster.pid
,但我确实在/usr/local/var/postgres.backup/postmaster.pid
下找到了postmaster.pid
,然后将其删除。但是我仍然得到相同的错误。
/usr/local/var/postgres/postmaster.pid
,但有/usr/local/var/postgres.backup/postmaster.pid
?
我今天遇到了同样的问题。重新启动计算机后,Postgres停止工作。如果您使用brew,您可以尝试brew services restart postgresql
,但这也不起作用。
这些命令对我有用:
pg_ctl -D /usr/local/var/postgres stop
然后start
pg_ctl -D /usr/local/var/postgres start
您还可以使用pg_ctl -D /usr/local/var/postgres status