如何判斷我的Postgresql服務器是否正在運行?如何檢查PostgreSQL服務器的狀態Mac OS X
我得到這個消息:
[~/dev/working/sw] sudo bundle exec rake db:migrate
rake aborted!
could not connect to server: Connection refused
Is the server running on host "localhost" and accepting
TCP/IP connections on port 5432?
更新:
> which postgres
/usr/local/bin/postgres
> pg_ctl -D /usr/local/bin/postgres -l /usr/local/bin/postgres/server.log start
pg_ctl: could not open PID file "/usr/local/bin/postgres/postmaster.pid": Not a directory
更新2:
>pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start
server starting
sh: /usr/local/var/postgres/server.log: No such file or directory
您還應該在Mac OS/X上尋找多個版本的postgres。如果你已經通過homebrew安裝了postgres,那麼當你的路徑設置不正確時,你可以得到上述錯誤 - 我只是意外地欺騙了我的路徑,一切開始使用postgres的系統安裝,直到我調整路徑使用brew安裝 –