![](/img/trans.png)
[英]No such file or directory Is the server running locally and accepting connections on Unix domain socket “/tmp/.s.PGSQL.5432”?
[英]Postgres connections on Unix domain socket "/tmp/.s.PGSQL.5432"?
我正在运行 MacOS 10.14.1(MacOS 的新手),我无法运行通过brew
安装的psql
命令,我收到以下错误,希望得到一些帮助:
psql: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/tmp/.s.PGSQL.5432"?
我尝试过的解决方案
brew services start
服务已经在运行brew services stop postgresql, brew services start postgresql
仍然是同样的错误brew remove postgres, brew install postgres, psql
仍然是同样的错误brew unlink postgresql && brew link postgresql
仍然是同样的错误rm -f /usr/local/var/postgres/postmaster.pid
我的/usr/local/var/
不包含postgres/
文件夹还有一件事要注意,当我brew install postgres
我收到一条警告:
Warning: The post-install step did not complete successfully
You can try again using `brew postinstall postgresql`
运行brew postinstall postgresql
给出相同的警告。
希望提供足够的信息,很高兴提供更多信息。
原因是该进程正在运行,但/usr/local/var/postgres/
缺少postmaster.pid
文件,因此您需要为Postgres
启动创建postmaster.pid
的进程。
如果进程已经在运行,
使用以下命令手动停止它:
pg_ctl -D /usr/local/var/postgres stop -s -m fast
使用以下命令手动启动它:
pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start
现在一切正常。
尝试这个
initdb /usr/local/var/postgres
我只是用 12.1 的现有 brew 安装来解决这个问题。
brew uninstall postgresql
brew install postgresql
这修复了它。 也把我从 12.1 带到了 12.3。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.