【发布时间】:2016-10-13 13:19:31
【问题描述】:
我正在运行 Rails 4.2.2,我的 postgres gem 是 0.17.1,昨天一切正常,但今天当我打开控制台并尝试连接到数据库时,我看到了这个错误:
PG::ConnectionBad: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/tmp/.s.PGSQL.5432"?
...然后当我尝试通过运行psql 连接到数据库时,我看到以下内容:
dyld: Library not loaded: /usr/local/opt/readline/lib/libreadline.6.dylib
Referenced from: /usr/local/bin/psql
Reason: image not found
Abort trap: 6
据我所知,自昨天以来我没有改变任何东西,所以我不确定为什么会发生这种情况。我尝试将 host: localhost 添加到我的 database.yml 中,但没有成功。值得注意的是,当我尝试使用类似 PSequel 的程序连接到数据库时,我看到以下内容:
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 服务器:sudo service postgresql restart
-
上面写着
sudo: service: command not found
标签: ruby-on-rails postgresql ruby-on-rails-4