簡體   English   中英

升級到Yosemite 10.10后無法連接到postgresql數據庫

[英]Unable to connect to postgresql database after upgrading to Yosemite 10.10

更新到Yosemite 10.10后,我無法連接到我的postgresql數據庫。 我運行rails控制台並嘗試獲取第一個用戶,但得到此錯誤...

>     ➜  game_golf git:(master) ✗ rails c
>     Loading development environment (Rails 4.1.4)
>     [1] pry(main)> User.first
>     PG::ConnectionBad: 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?
>     from /Users/pauldornfeld/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/activerecord-4.1.4/lib/active_record/connection_adapters/postgresql_adapter.rb:888:in `initialize'
>     [2] pry(main)>

我該怎么辦! 我試圖重新安裝postgresql,重新安裝自制程序。 請幫忙!

我找到了這個

cd /usr/local/var/postgres
mkdir pg_tblspc pg_twophase pg_stat_tmp

它對我有用。

檢查server.log將顯示它正在查找的目錄。 將它們添加到postgres目錄應該解決這個問題。 (上面要評論,但沒有足夠的聲譽)

最好通過安裝http://postgresapp.com/ app來使用easy方法! 10.9.4我也有同樣的問題。 還有10.10。

brew install postgres會在進行任何OS X升級時出現問題,因此請避免使用它。 所以安裝應用程序然后:

如果安裝不能立即使用,請將其添加到您的配置文件中。 對我來說,我從來沒有在我的個人資料中添加以下內容:

export PATH="/Applications/Postgres.app/Contents/MacOS/bin:$PATH"

此行必須位於個人資料的頂部:

export PATH=/usr/local/bin:$PATH

祝好運!

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM