Paul Godard
Paul Godard

Reputation: 1131

How to clear cache for database settings in Laravel 8?

I have deployed my project on my webserver. The .env contains the right settings for the web database but for some reason Laravel still try to connect to localhost.

The problem is that if I use any of the php artisan xxx:clear, it gives the same error:

SQLSTATE[HY000] [1698] Access denied for user 'root'@'localhost' ...

So I can I force Laravel 8 to clear the cache (as I guess this is the problem) and read the correct credentials in the .env file?

Upvotes: 2

Views: 15278

Answers (3)

beksonja
beksonja

Reputation: 1

took me 3 hours to find out that my original env file is in another folder, and i opened "backup" folder in my code :D

Upvotes: 0

Alshoja
Alshoja

Reputation: 527

The Optimize command still works like champ Try

php artisan optimize

It will clear

  1. Configuration cache
  2. Route cache
  3. Files cache

Upvotes: 1

Dhamo
Dhamo

Reputation: 86

hey you can use these commands

php artisan config:cache
php artisan config:clear
php artisan cache:clear

thanks :)

Upvotes: 5

Related Questions