DEV Community

Discussion on: The beauty of Docker for local Laravel development

Collapse
 
lideo profile image
lideo • Edited

I don't know if you were able to solve this or not, but this is what worked for me:

In your .env file change this

DB_HOST=localhost
Enter fullscreen mode Exit fullscreen mode

for this

DB_HOST=mysql
Enter fullscreen mode Exit fullscreen mode

I guess it's because you need to specify the name of the container running the database server and in docker-compose.yml the name for the mysql service is container_name: mysql.

Edit: I see now that the article clearly states that the value for DB_HOST needs to be mysql. For some reason my brain totally skipped that part...