Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Laravel database still use old name after .env changed [duplicate]

Edit: php artisan config:cache work nice, but now I got other problem. the URL giving me Error 500

I upload a project to a new subdomain area after I changed .env file when I open URL I still got an error with the old database and user

error screen shoot

I tried to check online with the .env file but - I don't know where he stored this database, I tried to see where is this name with ctrl+f but - nothing found

DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=faceterc_hot
DB_USERNAME=faceterc_hot
DB_PASSWORD=testpro

I expect to get the same error maybe but not with the old database name. and this gives me a indicate that maybe the file or something not changed or he using the other details from I don't know where

like image 545
Elroy Cohen Avatar asked Oct 30 '25 02:10

Elroy Cohen


1 Answers

Good, practice for, If you change in a .env file first restart the server using below command.

php artisan serve

then after run below more command for clear old cache and config.

composer dump-autoload
php artisan config:cache
php artisan config:clear
like image 154
Sujal Patel Avatar answered Oct 31 '25 16:10

Sujal Patel



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!