LoginSignup
17
25

More than 5 years have passed since last update.

”psql: could not connect to server: No such file or directory"となりPostgresqlに接続できない

Posted at

Macのローカル環境でサーバーに接続できなかったので、そのときの対処方法です。

まず、ローカルサーバーを立ち上げようとすると下記のようなエラー画面に。

スクリーンショット 2018-01-23 3.18.40.png

どうやらサーバーに接続できていない様子。

ターミナルでも同じようなエラーメッセージが表示されました。

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

以下の記事を参考にさせていただきました。
RailsでPostgreSQLを使うまでの設定

$ cd /usr/local/Cellar/postgresql
$ curl -o fixBrewLionPostgresql.sh http://nextmarvel.net/blog/downloads/fixBrewLionPostgres.sh
$ chmod 777 fixBrewLionPostgresql.sh
$ ./fixBrewLionPostgresql.sh
$ pg_ctl -D /usr/local/var/postgres start

順番に実行していくと問題なく表示されるようになりました。
よかった・・。

17
25
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
17
25