0
0

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.

Laravel7でDB接続エラー / SQLSTATE[HY000] [2002] Connection refused

Posted at

環境

  • Laravel 7.25
  • PostgreSQL 12.3

つまづいたこと

  • migration実行後、Laravel認証画面でユーザー新規登録をしようとしたらこのエラー
SQLSTATE[HY000] [2002] Connection refused  (SQL: select * from ~~.tables where ~~~)

前提

  • DBは作成してある
  • .envファイルはPostgres用に修正してある
DB_CONNECTION=pgsql
DB_HOST=127.0.0.1
DB_PORT=5432
DB_DATABASE=sample
DB_USERNAME=sample_app
DB_PASSWORD=
  • migration実行済み
  • モデル作成済み

解決方法

  • サーバーを一度落としてつなぎ直す
  • env.ファイルなど、設定に関係するファイルを変更した場合はサーバーをつなぎ直す必要がある
0
0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?