refactorian / laravel-docker

Laravel Docker Template - Laravel v11.x, PHP v8.3.x, MySQL v8.1.x, phpMyAdmin v5.x, Mailpit v1.x
286 stars 117 forks source link

DB Host Connection #109

Closed TianMeds closed 4 months ago

TianMeds commented 4 months ago

I was running my laravel backend as usual and already have my docker running. I can access the phpmyadmin and the account stated in the documentation but when i try to migrate my new Migration this what appears. My .env already been set like on the other issue here i tested the host to be in "db" i also try the "127.0.0.1" but both didn't work it can't migrate my migration

image

refactorian commented 4 months ago

@TianMeds Try the following steps :

  1. docker compose down
  2. Set DB_HOST=db in your .env
  3. docker compose up -d
  4. docker compose exec php bash
  5. php artisan config:clear
  6. php artisan migrate

If it still doesn't work, delete everything and create the environment again.