更新到优胜美地10.10后,我无法连接到我的postgresql数据库.我运行rails控制台并try 获取第一个用户,但出现了这个错误...

>     ➜  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)>

我该怎么办!我try 重新安装postgresql,重新安装homebrew.请帮忙!

推荐答案

你最好使用简单的方法安装http://postgresapp.com/应用程序!我对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

祝你好运

Postgresql相关问答推荐

带有regex表达式的Postgres SQL

PostgreSQL中如何在同一行中存储多个与单个值相关的ID?

IF 块中的 CREATE FUNCTION 语句抛出错误,同时运行它自己的作品

具有有限字母表的自定义字符串类型

PostgreSQL 函数按名称传递参数

Postgres内部如何计算月份间隔

当我写 SELECT ~1;在 Postgresql 上它给了我 -2 结果.这是什么原因?它一直持续〜4和-5等

如何为 JavaEE 应用程序中的 PostgreSQL 热备设置配置连接故障转移?

运算符不存在:integer = integer[] 在使用 ANY 的查询中

org.postgresql.util.PSQLException:错误:relation "app_user" does not exist

如何引用使用 ON CONFLICT 中的函数的唯一索引?

Rails ActiveRecord - 如何获取两个日期之间的记录

在 Windows 10 中执行时,Docker 容器关闭并给出data directory has wrong ownership错误

POSTGRESQL 中的 CHARINDEX (SQL SERVER) 相似函数是什么?

防止 CHARACTER VARYING 字段中出现空字符串

PostgreSQL 获取过go 12 小时的元素

postgres - 比较两个数组

全文的 Postgresql 前缀通配符

PostgreSQL 9 在 Windows 上安装:Unable to write inside TEMP environment path.

学习 PL/pgSQL 的好资源?