gpt4 book ai didi

macos - PG::ConnectionBad 升级到 Yosemite 和 postgresql 9.4.4

转载 作者:行者123 更新时间:2023-11-29 11:37:52 26 4
gpt4 key购买 nike

我刚刚将我的 mac OS X 更新为 Yosemite,版本 10.10.4,并将 postgresql 更新为:psql (PostgreSQL) 9.4.4。

在我的 Rails 4.2.1 应用程序上运行 rake db:migrate 后,我的终端 session 响应:

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?

在我的终端 session 中简单地输入 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

我找到了 this answer在 SO 上,但我犹豫要不要开始创建一堆目录,除非那真的是我想做的。我还找到了一个 older answer但我不太确定它是否是要遵循的那个。

SO answer建议我删除一个,/usr/local/var/postgres/postmaster.pid,但我没有,我有一个,/usr/local/var/postgres/postmaster.opts——我应该删除 postmaster。选择?

似乎有很多建议,但我不太确定要遵循什么。有人可以提供一些建议让我的 postgresql 数据库在我的 Rails 应用程序上运行吗?

最佳答案

您可以按照官方指南升级数据库:

brew switch postgres 9.3    # presuming you already installed 9.4.4
pg_dumpall > outputfile
launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist
mv /usr/local/var/postgres /usr/local/var/postgres.old
brew switch postgres 9.4.4
initdb -D /usr/local/var/postgres
psql -d postgres -f outputfile

PostgreSQL upgrade

关于macos - PG::ConnectionBad 升级到 Yosemite 和 postgresql 9.4.4,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31819446/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com