LoginSignup
0
0

More than 5 years have passed since last update.

postgresのdatabaseファイルの更新

Posted at

参照
http://qiita.com/blueplanet/items/58e511daa02b5684ec1d

こちらの記事そのまんまなんですが、今回9.4.1から9.6.3へのアップグレードが走って、結果

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

というエラーが出て起動しなくなりました。

ということで、先の記事にあるとおりやっていく

initdb /usr/local/var/postgres963 -E utf8
pg_upgrade -d /usr/local/var/postgres941 -D /usr/local/var/postgres963 -b /usr/local/Cellar/postgresql/9.4.1/bin/ -B /usr/local/Cellar/postgresql/9.6.3/bin/ -v

ここで以下のエラー。

connection to database failed: fe_sendauth: no password supplied

ここで参照
https://www.monotalk.xyz/blog/postgresql-connection-to-database-failed-fe_sendauth-no-password-supplied/

こちらを見ると全部trustにする、とあるので、

vim /usr/local/var/postgres941/pg_hba.conf
vim /usr/local/var/postgres/pg_hba.conf

編集して再度pg_upgrade

Upgrade Complete
----------------
Optimizer statistics are not transferred by pg_upgrade so,
once you start the new server, consider running:
    ./analyze_new_cluster.sh

Running this script will delete the old cluster's data files:
    ./delete_old_cluster.sh

無事完了したので起動。

pg_ctl -D /usr/local/var/postgres963 -l logfile start
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0