简体   繁体   中英

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?

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.

这应该为您解决问题。

 php artisan config:clear

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM