Maybe your config is cached? php artisan config:clear
Sep 21, 2017
3
Level 6
Load correct environment
Hi all, so I have three .env files:
- .env - required
- .env.local - developers
- .env.prod - online
And when I go to the site localhost:8000, I get
SQLSTATE[HY000] [1044] Access denied for user ''@'localhost' to database 'forge'
because its still using .env variables when in fact I want it to use .env.local.
Here is .env:
APP_ENV=false
APP_DEBUG=true
APP_KEY=
APP_TIMEZONE=America/Chicago
CACHE_DRIVER=file
QUEUE_DRIVER=sync
and my .env.local:
APP_ENV=local
APP_DEBUG=true
APP_KEY=
APP_TIMEZONE=America/Chicago
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=test
DB_USERNAME=root
DB_PASSWORD=
CACHE_DRIVER=file
QUEUE_DRIVER=sync
So, as you can see, it should load the .env.local.
Even doing: php artisan migrate --env=local yields me: SQLSTATE[HY000] [1044] Access denied for user ''@'localhost' to database 'forge' when .env.local's DB_DATABASE is test
`
What am I doing wrong?
Please or to participate in this conversation.