I can\'t use the same database.php settings when browsing the local website in a browser (example.app:8000) and when using php artisan migrate.
If my database.php se
Ben Swinburne's answer worked for me.
I added the following to my Homestead.yaml file
variables:
- key: APP_ENV
value: local
- key: DB_HOST
value: 127.0.0.1
- key: DB_PORT
value: 3306
This updates what our code uses to connect to mysql from within the VM. Because they are set within the VM, they will take precedence over what is in the .env file. I believe values within the .env file are only set if they don't already exist within the server environment variables.
Then within the .env running on the host machine, I have what is needed to connect to mysql from the outside of the VM going in.
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=33060
DB_DATABASE=mydb
DB_USERNAME=homestead
DB_PASSWORD=mypassword
Now, I can use artisan migrate outside of the VM and inside the VM without any connection and port issues. Browsing the website also works as expected.