这是我今天尝试使用以下命令登录到我的 localhost PosgreSQL 数据库时收到的错误消息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"?
Run Code Online (Sandbox Code Playgroud)
我使用 Homebrew 安装了 PostgreSQL,今天早上我使用该实用程序卸载并重新安装了 PostgreSQL,没有观察到任何变化。该psql客户端工作正常,我仍然可以使用它来连接到网络上的数据库。我一两个月只连接到我的本地数据库一次,之前它运行良好,所以我假设这是由于一些自动更新,但我不知道是哪个。Mac OS 最近将自身升级到 High Sierra (10.13)。
2014 年这里出现了相同的错误消息(链接),但这是一个人在启动服务器时遇到问题的情况。就我而言,我相信它正在运行——我已经使用过brew services start postgresql,是的,我今天重新启动了几次。但是,错误中提到的文件 ,/tmp/.s.PGSQL.5432在我的系统上不存在。我认为这是一些配置错误的情况。任何人都知道如何解决?
更新:我尝试手动启动服务器(按照 Evan 的建议),我认为我取得了突破。这是我尝试手动启动时遇到的错误:
FATAL: database files are incompatible with server
DETAIL: The data directory was initialized by PostgreSQL version 9.6, which is not compatible with this …Run Code Online (Sandbox Code Playgroud)