4
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

「localhost:5432 への接続が拒絶されました。ホスト名とポート番号が正しいことと、postmaster がTCP/IP接続を受け付けていることを確認してください。」で困った話

Posted at

ポートフォリオを作成中リポジトリ名を変更したくて変更した後再度プロジェクトをデバッグにかけたら,
「localhost:5432 への接続が拒絶されました。ホスト名とポート番号が正しいことと、postmaster がTCP/IP接続を受け付けていることを確認してください。」
というエラーが出てしまいました。
これはどうやら、前回プロジェクトを終了したときに動いていたポストグレスSQLサーバーがまだ動いていることが原因のよう。

問題に対して以下のように対処したので備忘録として残しておきます。

参考にしたYoutube

  1. PostgreSQLのアプリを開く。この時、「Stale postmaster.pid file」となっている スクリーンショット 2020-12-20 8.59.11.png

  2. [Server Settings]を押下

  3. 「Data Directory」項目の「/Users/XXXXX/Library/Application Support/Postgres/var-12」を確認

  4. 3.のディレクトリにcdで移動してlsコマンド実行

  5. 「postmaster.pid」ファイルを見つける

  6. rmコマンドで5.のファイルを削除する
    再度PostgreSQLアプリを立ち上げ、[Start]を押下して、「Running」になっていることを確認するスクリーンショット 2020-12-20 8.50.53.png

  7. VScodeで再度デバッグ実行→正常!

4
1
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
4
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?