1

I want to change the DB in my Laravel project. I move to the .env file and changed the db name. But after I changed the db name, the larval project use still the old db. But why?

1
  • What's your config/database.php look like? Commented Jul 20, 2017 at 20:23

5 Answers 5

4

Write in your terminal

php artisan config:clear

Sign up to request clarification or add additional context in comments.

2 Comments

It doesn't work. I make a change in .evn and .evn_example but nothing happens. This project is a copy from another project but I'dont think that is is a problem?
in that case you have to run composer update command in your terminal.
1

The laravel configuration take credentials project get data from .env file Please try:

    $ composer dump

or

    $ composer dumpautoload

and then try to run the command

    $ php artisan config:clear

It worked form me when I had the same problem.

If this does not work please delete the content from cache in the directory bootstrap\cache and then try the above command again. Please make backup before delete.

Comments

1

Please try to delete the content from the folder

project_root_directory/Bootstrap/cache 

and then try composer dump and try again to run the project.

Comments

1

Follow this step.

php artisan cache:clear

php artisan config:clear

php artisan config:cache

php artisan route:clear

php artisan route:cache

Comments

0

Change DB credentials in .env file and Run php artisan config:cache. DB values will be changed right away .

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.