Reputation: 744
I'm working with Laravel, and everything is fine so far. But sometimes, when I request a webpage, an error occurs :
🧨 SQLSTATE[HY000] [1045] Access denied for user 'forge'@'localhost' (using password: NO)
I don't understand why and when this error occurs, it seems very random (~1%), and reloading the page fix it. My .env file looks like this :
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=docfus
DB_USERNAME=my_username
DB_PASSWORD=obviously_azerty
Where does this user 'forge' come from ? I never had one, I don't understand why is Laravel looking for it.
Note : I'm saying that this error seems to be random because I use Ajax to load some subPage in my main page. And sometimes one of theses elements fail to load with this error, but not everytimes and not always the same.
Edit : I tried php artisan config:clear
and php artisan cache:clear
but I still get the error times to times.
Upvotes: 0
Views: 6328
Reputation: 1
My issue was resolved with the following:
Upvotes: 0
Reputation: 1182
php artisan config:clear
is your friend ;) forge
is default database name and username and it's part of database.php in config. There is possibility that you cache config files before setting up environment in .env file
Upvotes: 1