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
for this
DB_HOST=mysql
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...
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
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...
In your .env file for your Laravel application, what are your values for the database credentials?
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
for this
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...