Postgres-致命:数据库文件与服务器不兼容 [英] Postgres - FATAL: database files are incompatible with server

查看:2119
本文介绍了Postgres-致命:数据库文件与服务器不兼容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

重新启动MacBook Pro后,我无法启动数据库服务器:

After restarting my MacBook Pro I am unable to start the database server:

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"?

我检查了日志,并且以下行一遍又一遍地出现:

I checked the logs and the following line appears over and over again:

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.0.4.

9.0.4是Mac上预装的版本,9.2 [.4]是我通过Homebrew安装的版本. 如前所述,它曾经在重新启动之前起作用,因此实际上并不是编译问题.我还重新运行了initdb /usr/local/var/postgres -E utf8,该文件仍然存在.

9.0.4 was the version that came preinstalled on the mac, 9.2[.4] is the version I installed via Homebrew. As mentioned, this used to work before the restart, so it can't actually be an compiling issue. I also re-ran initdb /usr/local/var/postgres -E utf8 and the file still exists.

不幸的是,我对Postgres来说还很陌生,所以任何帮助将不胜感激.

Unfortunately, I am pretty new to Postgres, so any help would be very much appreciated.

推荐答案

如果您最近从10.x升级到11或12 ,则可以运行以下命令来升级保留所有内容的postgres数据目录数据:

If you recently upgraded to 11 or 12 from 10.x you can run the below command to upgrade your postgres data directory retaining all data:

brew postgresql-upgrade-database

以上命令取自brew info postgres

这篇关于Postgres-致命:数据库文件与服务器不兼容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆