PostgreSQL:重新启动后无法连接到服务器

发布于 2025-02-07 01:36:04 字数 1235 浏览 1 评论 0原文

我正在运行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.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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

软甜啾 2025-02-14 01:36:04

我今天有同样的问题。重新启动计算机后,Postgres停止工作。如果您使用啤酒,则可以尝试brew Services重新启动PostgreSQL,但这也无效。

这些命令对我有用:

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

然后开始

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

您也可以使用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:

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文