2

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?

7
  • you need to clear php artisan config:clear for clear env data Commented Feb 19, 2021 at 13:09
  • you can set db credential into config > databse.php and into the bootstrap folder, probably you will find a cache folder .. delete cache folder .... I think it will be okay.. Commented Feb 19, 2021 at 13:10
  • @نور the cache folder is created again as well for older version and in newer version the path of cache folder is changed & is placed in vendor Commented Feb 19, 2021 at 13:16
  • try this command:- php artisan optimize Commented Feb 19, 2021 at 13:19
  • @bhucho for removing current cache , I suggest to delete... I faced similar problem before.. actually it's worked for me...what is the issue ? Commented Feb 19, 2021 at 13:19

3 Answers 3

5

hey you can use these commands

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

thanks :)

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

Comments

1

The Optimize command still works like champ Try

php artisan optimize 

It will clear

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

Comments

0

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

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.