【发布时间】:2015-10-27 10:59:42
【问题描述】:
我刚刚将我的 mac OS X 更新为 Yosemite 版本 10.10.4,并将 postgresql 更新为:psql (PostgreSQL) 9.4.4。
在我的 Rails 4.2.1 应用程序上运行 rake db:migrate 后,我的终端会话响应:
rake aborted!
PG::ConnectionBad: 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?
could not connect to server: Connection refused
Is the server running on host "localhost" (::1) and accepting
TCP/IP connections on port 5432?
在我的终端会话中简单地输入 psql 也显得有点不对劲:
$ psql
psql: 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"?
从 cat /usr/local/var/postgres/server.log 打印出日志后,我读到:
DETAIL: The data directory was initialized by PostgreSQL version 9.3, which is not compatible with this version 9.4.4.
LOG: skipping missing configuration file "/usr/local/var/postgres/postgresql.auto.conf"
FATAL: database files are incompatible with server
我在 SO 上找到了this answer,但我犹豫是否要开始创建一堆目录,除非我真的应该这样做。我还找到了一个older answer,但不太确定它是否是要关注的。
这个SO answer 建议我删除一个 /usr/local/var/postgres/postmaster.pid,但我没有,我有一个 /usr/local/var/postgres/postmaster.opts - - 我应该删除 postmaster.opts 吗?
似乎有很多建议,但我不太确定要遵循什么。有人可以提供一些建议,让我的 postgresql 数据库在我的 Rails 应用程序上运行吗?
【问题讨论】:
标签: macos postgresql rails-4-2-1