LoginSignup
5
5

More than 5 years have passed since last update.

Homebrew でインストールした PostgreSQL に接続できない時に確認すべきこと

Last updated at Posted at 2016-09-20

たまに起きては 5 分ほど時間を無駄にしてしまうので。
これを書くことで次回はすんなり解決できますように。

brew services start postgresql とかしても postgres プロセスがいない場合用。
(だいたい OS が異常終了した後の再起動時に起こるけど何故か毎回忘れてしまっている)

とりあえずエラーログを見る

Homebrew でインストールした場合のエラーログはここに保存されている。

/usr/local/var/postgres/server.log

おもむろに tail するとこんなログが出ていたりする。

FATAL:  lock file "postmaster.pid" already exists

postmaster.pid を消す

一応先に書いておくと、本来あまり良いやり方ではないです。
開発環境で、最悪データが全部消えても問題ない、という前提です。

ファイルはここにある。

/usr/local/var/postgres/postmaster.pid

tmux の中からだと何故かプロセスが起動できない

tmux の中からだと何故か brew services start postgresql してもうまく起動してくれないので tmux の外でやってみましょう。

おしまい

5
5
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
5
5