'Homestead migrate mysql problems

I've a problem with my laravel project. I can only use php artisan migrate by vagrant ssh. In normal terminal it shows me a connection error with database.

This is my env file

DB_CONNECTION=mysql
DB_HOST=localhost
DB_PORT=33060
DB_DATABASE=db_corsi
DB_USERNAME=homestead
DB_PASSWORD=secret


Solution 1:[1]

change port DB_PORT=33060 to DB_PORT=3306

Solution 2:[2]

I think this is not an issue because vagrant is VM so you need to access it to can run the artisan migrate

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Gev99
Solution 2 Ahmed Hassan