对于我的rails应用程序,每次我尝试使用rails console时,都会收到此错误:
server: Connection refused (PG::ConnectionBad)
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?
我怀疑这是因为我的postgres服务器已关闭..所以我使用了吃午餐的宝石来停止并启动我的服务器。但是,我仍然遇到同样的错误。
lunchy stop postgres
lunchy start postgres
我也试过这个:
pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start
得到server starting
但当我这样做时:pg_ctl -D /usr/local/var/postgres status
,它不起作用,因为我得到pg_ctl: no server running
为什么会这样?