Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Clear Laravel cache(s) without Artisan command [duplicate]

I've moved my project but have run into an issue. I'm discovering that the old settings (which have been changed in my .env to reflect the changed host) are still being used by my project.

I can't access my project through a browser as it returns this error: SQLSTATE[HY000] [1045] Access denied for user 'appReop'@'localhost' (using password: YES) (SQL: select * from `settings` limit 1)

appReop was the previous login username. And while I could just create a new user to reflect this, I also run into an issue about the old password being too weak for the current database configuration.

When I go to run php artisan cache:clear, it returns the same above error. So I was curious if there was a way to manually clear the caches to fix my errors?

Update

This shows the three errors that pop up after running any Artisan command:

enter image description here

like image 286
Matthew Avatar asked Nov 29 '18 18:11

Matthew


2 Answers

Not sure you have solved this, my suggestion is remove the files inside below folder. So the database connection cache file will create again after removed. (Laravel 5)

/<root>/bootstrap/cache/*

Hope it helps :)

like image 128
Jimmy Avatar answered Sep 20 '22 01:09

Jimmy


You can call an Artisan command outside the CLI.

Route::get('/clear-cache', function() {
   $exitCode = Artisan::call('cache:clear');
   // return what you want
});

You can check the official doc here http://laravel.com/docs/5.0/artisan#calling-commands-outside-of-cli

like image 42
MD. Jubair Mizan Avatar answered Sep 18 '22 01:09

MD. Jubair Mizan