LoginSignup
0
0

More than 1 year has passed since last update.

Laravel初期設定でDB接続エラーが発生

Posted at

Laravel9 を マニュアルに沿ってインストール
php artisan migrate

すると以下のエラーが発生(WinでもMacでも)

SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo for mysql failed: nodename nor servname provided, or not known (SQL: select * from information_schema.tables where table_schema = example_app and table_name = migrations and table_type = 'BASE TABLE')

.env の
DB_HOST=mysql
をいかに変更してリトライ
DB_HOST=localhost
すると、以下のエラーに
SQLSTATE[HY000] [2002] No such file or directory (SQL: select * from information_schema.tables where table_schema = example_app and table_name = migrations and table_type = 'BASE TABLE')

さらに
DB_HOST=127.0.0.1
としてリトライしたら成功!

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