DEV Community

Discussion on: The beauty of Docker for local Laravel development

Collapse
 
lalustine7 profile image
Lalustine • Edited

Thank you for your good tutorial.Can you help me in this issue? I tried everything but no use. I am running on window 10 but linux containers.

Illuminate\Database\QueryException : SQLSTATE[HY000] [2002] Connection refused (SQL: select * from information_schema.tables where table_schema = default and table_name = migrations)

thepracticaldev.s3.amazonaws.com/i...

Collapse
 
aschmelyun profile image
Andrew Schmelyun

In your .env file for your Laravel application, what are your values for the database credentials?

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...