331

MacBook Pro を再起動した後、データベース サーバーを起動できません。

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

ログを確認したところ、次の行が何度も表示されます。

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しましたが、ファイルはまだ存在しています。

残念ながら、私はPostgresにかなり慣れていないので、助けていただければ幸いです。

4

12 に答える 12

8

As @Gowtham mentioned, you can solve this problem by executing a brew command

brew postgresql-upgrade-database The above command is taken from the output of brew info postgres

However, don't forget to stop the postgres service before executing it, use the following command: `brew services stop postgresql

you may have to start the service again.

So the final order of commands are:

brew services stop postgresql
brew postgresql-upgrade-database
brew services start postgresql  
于 2021-12-21T19:05:07.757 に答える