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”?
(*我已经阅读了很多有关此错误的SO主题,但推荐的解决方案并未解决此问题)
将postgres作为服务启动:
brew services restart postgresql
Stopping
postgresql
… (might take a while)
==> Successfully stoppedpostgresql
(label: homebrew.mxcl.postgresql)
==> Successfully startedpostgresql
(label: homebrew.mxcl.postgresql)
在终端中手动运行postgres:
我可以通过在终端窗口中运行来完成所有工作,但我更喜欢在后台运行它.
postgres -D /usr/local/var/postgres9.6.3
集群:
我在/usr/local/var中有3个数据库集群,但我想使用postgres9.6.3 /
postgres postgres9.5/ postgres9.6.3/
哪一个:
路径:
echo $PATH返回/usr/local/bin和/usr/local/var(已添加)
其他推荐解决方案
很多人都可以通过删除/postgres/postmaster.pid来解决这个问题,但这个文件对我来说并不存在.
UPDATE
运行ps -ef | grep postgres,仅输出,
501 2135 1530 0 12:08pm ttys002 0:00.00 grep postgres
使用brew servies重新启动postgres后,/usr/local/var / log中的postgres.log包含,
FATAL: database files are incompatible with server DETAIL: The data directory was initialized by Postgresql version 9.5,which is not compatible with this version 9.6.3.
解决方法
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。