PostgreSQL:重新启动后无法连接到服务器
我正在运行Macos Monterey版本12.2。
重新启动笔记本电脑后,我无法再连接到我的PostgreSQL Server。并且正在遇到此错误:
(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
。我找不到postmaster.pid
在建议的路径(/usr/local/var/var/postgres/postmaster.pid
)中,但是我确实找到了postmaster.pid
在/usr/local/var/postgres.backup/postmaster.pid
下,我然后删除了。但是我仍然遇到同样的错误。
谁能帮我吗?任何人都可以帮助澄清为什么我没有/usr/local/var/postgres/postmaster.pid
,但确实有/usr/local/local/var/postgres.backup/postmaster.pid << /代码>?
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.pid
under /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
?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我今天有同样的问题。重新启动计算机后,Postgres停止工作。如果您使用啤酒,则可以尝试
brew Services重新启动PostgreSQL
,但这也无效。这些命令对我有用:
然后
开始
您也可以使用
pg_ctl -d/usr/local/local/var/postgres状态
检查状态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:
Then
start
You can also check status with
pg_ctl -D /usr/local/var/postgres status