I just created a fresh laravel project and I'm using a Homestead vagrant box by running
vagrant init laravel/homestead
and after
Vagrant Up
When I use vagrant ssh it gives me no problem and I can acces the vagrant box, however when I want to connect to the DB with Heidisql I get a connection error:
can't connect to mysql server on 'localhost' (10061)
Here's my setup
the password I'm using = "secret"
解决方案
You should be using the port 33060 instead of 3306 according to the official documentation.
The .env file should also be updated accordingly, so you won't have issues when running your first migration, as the Laravel installation is running inside the virtual machine you need the default port 3306 there.