升级Homebrew中的PostgreSQL

最后还是入手了新版的MBP,开发环境都是重新设置的,用PostgreSQL的时候,启动提醒版本不兼容

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

所以要升级一下原来的库,作弊条开始

  • brew services stop postgresql
  • brew install [email protected]
  • initdb /usr/local/var/postgres9.6 -E utf8
  • 开始升级数据库
pg_upgrade \
  -d /usr/local/var/postgres \
  -D /usr/local/var/postgres9.6 \
  -b /usr/local/Cellar/[email protected]/9.5.6/bin \
  -B /usr/local/Cellar/postgresql/9.6.2/bin/ \
  -v

  • mv /usr/local/var/postgres /usr/local/var/postgres9.5
  • mv /usr/local/var/postgres9.6 /usr/local/var/postgres
  • brew services start postgresql

完成


Last modified on 2017-04-20