这是我的错误。
PG::Error - 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" (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" (fe80::1) and accepting
TCP/IP connections on port 5432?
我使用homebrew将postgresql安装到/ usr / local / bin / psql中 为了让它识别这个版本,我必须将它添加到我的bash文件中。
export PATH="/usr/local/bin:/usr/local/sbin:~/bin:$PATH"
当我进入我的rails应用程序并运行命令
时rails s
它以下面的
启动=> Booting Thin
=> Rails 4.0.0.beta1 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
>> Thin web server (v1.5.0 codename Knife)
>> Maximum connections set to 1024
>> Listening on 0.0.0.0:3000, CTRL+C to stop
然后,当我尝试在http://0.0.0.0:3000
上查看应用时,我收到了上述错误
任何人都可能知道为什么会这样。
答案 0 :(得分:0)
正如消息所说,导致此错误的最可能原因是您实际上并未运行postgres服务器。通常你用* / etc / init.d / pg_ctl *启动它,但是因为你通过brew安装它,只需在终端窗口中运行以下命令
postgres
服务器应该启动。如果您没有将此设置设置为在启动时自动启动,则每次重新启动计算机后都需要运行该命令。