当前位置: 首页 > 知识库问答 >
问题:

PostgreSQL错误“无法连接到服务器:没有这样的文件或目录”

帅德惠
2023-03-14
ps -aef|grep postgres                                                                                                   (ruby-1.9.2-p320@jct-ana) (develop) ✗
  501 17604 11329   0   0:00.00 ttys001    0:00.00 grep postgres
✪ launchctl load -w /usr/local/Cellar/postgresql/9.1.4/homebrew.mxcl.postgresql.plist                                                        (ruby-1.9.2-p136) 
homebrew.mxcl.postgresql: Already loaded

我怎么解决这个?我没看到什么?

ps:~/library/launchagents包含两个PostgreSQL.plist文件。我不确定这是否相关。

org.postgresql.postgres.plist
homebrew.mxcl.postgresql.plist

我尝试了以下方法,得到了如下结果。

psql: could not connect to server: Connection refused
    Is the server running on host "localhost" (127.0.0.1) and accepting
    TCP/IP connections on port 5432?
could not connect to server: Connection refused
    Is the server running on host "localhost" (::1) and accepting
    TCP/IP connections on port 5432?
could not connect to server: Connection refused
    Is the server running on host "localhost" (fe80::1) and accepting
    TCP/IP connections on port 5432?
$ which psql // This tells you which PostgreSQL you are using when you run $ psql. 
$ echo $PATH

确保要运行的PostgreSQL副本的路径条目位于OS ;X系统的PostgreSQL的路径之前。

这是一个核心需求,它决定了哪个PostgreSQL可以运行,而且我被告知是导致这些问题的原因。

共有1个答案

卓云
2023-03-14

检查postgres目录中没有postmaster.pid,可能是/usr/local/var/postgres/

删除此并启动服务器。

check-https://github.com/mperham/lunchy是一个很好的launchCTL包装器。

 类似资料: