升级到优胜美地10.10后无法连接到Postgresql数据库 [英] Unable to connect to postgresql database after upgrading to Yosemite 10.10
问题描述
更新到优胜美地10.10后,我无法连接到我的postgresql数据库。我运行rails控制台并尝试获取第一个用户,但遇到此错误...
After updating to Yosemite 10.10 I cannot connect to my postgresql database. I run the rails console and try and get the first user but get this error...
> ➜ 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,重新安装自制软件。
What do I do! I have tried to reinstall postgresql, reinstall homebrew. Please help!
推荐答案
最好通过安装 http://postgresapp.com/ 应用!我在10.9.4中也遇到了同样的问题。同样使用10.10。
You are better off using the easy method by installing the http://postgresapp.com/ app! I too had this same issue with 10.9.4. Also with 10.10.
brew install postgres
在进行任何OS X升级时都会出现问题,因此请避免使用。因此,请安装该应用,然后:
brew install postgres
will give issues when doing any OS X upgrades so avoid it. So install the app then:
如果无法立即进行安装,请将其添加到您的个人资料中。对我来说,我不必在个人资料中添加以下内容:
Add this to your profile if the install do not work out of the box. For me I never had to add the below in my profile:
export PATH="/Applications/Postgres.app/Contents/MacOS/bin:$PATH"
此行必须位于个人资料的顶部:
This line must be at the top of your profile:
export PATH=/usr/local/bin:$PATH
祝你好运!
这篇关于升级到优胜美地10.10后无法连接到Postgresql数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!