Jorge Anzola
Jorge Anzola

Reputation: 1235

SQLSTATE[28000] [1045] Access denied for user 'root'@'localhost' (using password: NO) Laravel in production

Well, basically I got this error when I moved my project from local to production. In local it works perfectly. At first I thought Laravel wasn't reading .env, so I hardcoded the access data in database.php, but anything changed. I'm in a shared hosting and I don't hace access to the console. Any ideas?

Upvotes: 1

Views: 2339

Answers (2)

GabMic
GabMic

Reputation: 1482

This should do the trick for you.

 php artisan config:clear

Upvotes: 0

Lionel Chan
Lionel Chan

Reputation: 8059

If it doesn't pick up .env, it could means it's reading directly from the cached config. Changing database.php wouldn't help because config has been cached.

In your production file manager, look for /bootstrap/cache/config.php and delete it. It will manually clear the config cache on your production server and laravel should now picking up database configuration string from .env again.

Upvotes: 3

Related Questions