33
23

More than 5 years have passed since last update.

PostgreSQLをアップグレードしたら動かなくなったのでやったこと

Last updated at Posted at 2016-02-20

環境とか

  • MacOSX El Capitan

Homebrewを使って、PostgreSQL9.4系から9.5系にアップグレード
主にチラシ裏のメモ書き

起こったこと

$ brew upgrade postgresql

と、なんの気なしにPostgreSQLをアップグレードしたら、

$ psql -l
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"?

という具合に怒られるようになりました。$ rake db:migrate とかもできないorz

/usr/local/var/postgres/postmaster.opts で新しいバージョン書き換えたりしても同じエラーメッセージが。。

最終的には

$ brew uninstall postgresql
$ brew install postgresql
$ rm -rf /usr/local/var/postgres && initdb /usr/local/var/postgres -E utf8
$ postgres -D /usr/local/var/postgres

と、PostgreSQLを再インストールし、元々のPostgreSQLのディレクトリを削除し、初期化したあと起動してどうにか解決しました。

いつも場当たり的な対応してはまってるので、もっとちゃんとドキュメントとか読んで、何がどうなってるのかも理解しようとしなければ。。

参考
Postgres could not connect to server - stackoverflow

33
23
3

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
33
23