我遇到了这个问题:我过去用Homebrew安装了PostgreSQL,然后我想我用brew upgrade ,无意识地更新了它的版本,我无法再次启动它。
它曾经工作过,但现在每当我试图访问它时,就会出现这个错误。
psql: error: 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"?
服务器运行正常,因为ps aux | grep postgres 显示了它的进程。
我尝试了各种解决方案,直到简单地重新安装它都很正常。
我运行了
brew uninstall postgresql
brew install postgresql
brew services start postgresql
然后我就能再次连接到数据库了。