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 1 year has passed since last update.

Docker環境でLaravelからDB接続がうまくいかないときの対処

Posted at

WSL2,DOcker環境にてLaravelのmigration実行の際エラー

 Illuminate\Database\QueryException  : SQLSTATE[HY000] [2002] No such file or directory (SQL: select * from information_schema.tables where table_schema = sample and table_name = migrations and table_type = 'BASE TABLE')

  at /var/www/html/vendor/laravel/framework/src/Illuminate/Database/Connection.php:664
・・・

こんな感じのエラーが出たら.envのDB_HOSTを見直す。
localhostや127.0.0.1ではなく、WSLに割り当てられたglobalIPを設定する。
確認の方法は以下コマンド。

ip -4 address
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?