neoighodaro / laravel-docker

Getting Started With Laravel and Docker.
55 stars 27 forks source link

Can't connect to local MySQL server through socket #2

Closed hasentopf closed 6 years ago

hasentopf commented 6 years ago

SQLSTATE[HY000] [2002] Can't connect to local MySQL server through socket '/run/mysqld/mysqld.sock' (2 "No such file or directory")

Both docker machines started, but it seems to me that "web" can't connect to "mysql"? Can you help me with this issue?

Viktorminator commented 6 years ago

@hasentopf delete your default docker virtual machine and install it again

hasentopf commented 6 years ago

Thanks. The solution was the name of the DB_HOST in the .env file. I use "DB_HOST=mysql" and now it connects to the db.