Reputation: 4888
I created a new project and set up my database accordingly in the .env
file.
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=8889
DB_DATABASE=example_olddb
DB_USERNAME=example_user
DB_PASSWORD=example_password
After much development, I want to change my database to a new database. So I edited the '.env' file again.
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=8889
DB_DATABASE=example_newdb///<-- change here
DB_USERNAME=example_user
DB_PASSWORD=example_password
However, I got the following error.
SQLSTATE[HY000] [1049] Unknown database 'example_olddb'
It used to work in Laravel 5.5
and 5.6
, but not now in 5.7
. I tried to clear the cache, but same error persists. How can I resolve this issue?
Upvotes: 3
Views: 8022
Reputation: 10111
After completion of .env
edit, You can clear the configuration cache with the following artisan command: php artisan config:cache
Upvotes: 3