Postgresql 数据库内容从 10.xxx 升级到 11.5

我 Mac 本地的 psql version 升级到了 11.5。今天尝试使用的时候,提示:

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

使用 postgres -D /usr/local/var/postgres 提示如下

2019-09-28 17:51:45.900 CST [11669] FATAL:  database files are incompatible with server
2019-09-28 17:51:45.900 CST [11669] DETAIL:  The data directory was initialized by PostgreSQL version 10, which is not compatible with this version 11.5.

Google 了一下,找到这个命令可以用:

brew postgresql-upgrade-database
屏幕快照 2019-09-28 18.04.07.png

这次终于成功了

升级本地数据库

brew upgrade postgres

如果是一个pid文件锁定postgre阻止其启动,删除该pid文件:
rm /usr/local/var/postgres/postmaster.pid

你可能感兴趣的:(Postgresql 数据库内容从 10.xxx 升级到 11.5)