PDOExceptionvendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php:47
SQLSTATE[HY000] [1045] Access denied for user 'forge'@'localhost' (using password: YES)
我已经使用正确的凭据更新了 .env 文件(它甚至不再是本地主机,而是一个 IP 地址),但是我不断收到此错误消息。我也已经运行了
php artisan config:clear
。如何强制生产应用程序使用其 .env 文件中的新凭据?我的 config/database.php 是标准的:
'connections' => [
'mysql' => [
'driver' => 'mysql',
'host' => env('DB_HOST', 'localhost'),
'database' => env('DB_DATABASE'),
'username' => env('DB_USERNAME'),
'password' => env('DB_PASSWORD'),
'port' => env('DB_PORT', '3306'),
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',
'strict' => false,
],
],
最佳答案
运行以下 Artisan 命令,然后重试:
php artisan cache:clear
php artisan config:clear
php artisan config:cache
php artisan route:clear
php artisan route:cache
关于laravel-5 - Laravel 5 应用程序继续使用旧的数据库连接,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/30609092/