Laravel 5应用程序继续使用旧的数据库连接 [英] Laravel 5 app keeps using old database connection

查看:97
本文介绍了Laravel 5应用程序继续使用旧的数据库连接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

PDOExceptionvendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php:47

SQLSTATE[HY000] [1045] Access denied for user 'forge'@'localhost' (using password: YES)

我已使用正确的凭据更新了.env文件(它甚至不再是localhost,它是IP地址),但是我一直收到此错误消息.我也已经运行过php artisan config:clear了.如何强制生产应用程序使用其.env文件中的新凭据?

I have updated .env file with the correct credentials (its not even localhost anymore, its an IP address) however I keep getting this error message. I have already run php artisan config:clear as well too. How can I force a production app to use the new credentials in its .env file?

我的config/database.php是标准的:

My config/database.php is standard:

'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,
    ],

],

推荐答案

上帝,好主意,几乎无法解决这个问题. Web请求上的数据库连接没有问题,但是我的错误报告中仍然出现连接错误.似乎问题出在我们正在运行的队列中,其中包含旧的配置值.

Good lord, almost lost my mind trying fix this. There was no problem with the DB connection on the web requests, but I was still getting connection errors in my bug reporting. Seems the issue was the queue we were running was holding the old config values.

ps aux | grep php

找到queue:work进程并将其终止,它将自动重新启动,但会读取您的新配置值.

Find the queue:work process and kill it, it will start up again automatically but read in your new config values.

这篇关于Laravel 5应用程序继续使用旧的数据库连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆