gpt4 book ai didi

postgresql - 更新/升级 brew 后如何修复 postgres

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

我升级到 mavericks 并在安装/编译新 gems 时遇到了一些问题,所以我重新安装了 xcode 并进行了 brew 更新和升级。 Gems 现在可以工作了,甚至 postgres 也可以继续工作一段时间,直到最近重新启动。现在 postgres 似乎有问题。

postgres:

postgres does not know where to find the server configuration file.
You must specify the --config-file or -D invocation option or set the PGDATA environment variable.


brew info postgres:

postgresql: stable 9.3.2 (bottled)
http://www.postgresql.org/
Conflicts with: postgres-xc
/usr/local/Cellar/postgresql/9.2.4 (2842 files, 39M)
Built from source
/usr/local/Cellar/postgresql/9.3.2 (2924 files, 39M) *
Poured from bottle

postgres -D /usr/local/var/postgres:

FATAL: database files are incompatible with server
DETAIL: The data directory was initialized by PostgreSQL version 9.2, which is not compatible with this version 9.3.2.

我现在应该怎么做才能让我的数据库重新工作?

最佳答案

$ brew tap homebrew/versions
$ brew install postgresql92
$ brew switch postgresql 9.2.8 # might need to check this one, could be newer by the time you read this
$ pg_dumpall > ninedottwo-dump
$ brew uninstall postgresql92
$ brew switch postgresql 9.3.4 # again, check version
$ pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start
$ createdb # i got an error about my database not existing, so i had to run this
$ psql < ninedottwo-dump
$ bundle exec rails s

感谢 Peter 让我朝着正确的方向开始。

编辑:这会教我一次升级所有东西......

关于postgresql - 更新/升级 brew 后如何修复 postgres,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20754669/

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