问题
I am trying to deploy my Laravel app on a DigitalOcean droplet. The droplet is setup with nginx, php7, and postgres, I follow up the tuts from DigitalOcean on how to set them up. Then I try to follow this tutorial on how to deploy the Laravel app using the git hook and so on.
Now the app itself is up and running, I can access the pages and all. But I can't run php artisan migrate
. I have been changing the database username, name, password on .env
file, but I always get the exact same error:
[Illuminate\Database\QueryException]
SQLSTATE[08006] [7] FATAL: password authentication failed for user "deploy"
FATAL: password authentication failed for user "deploy" (SQL: select * from information_schema.tables where table_schema = apollo and table_name = migrations)
[Doctrine\DBAL\Driver\PDOException]
SQLSTATE[08006] [7] FATAL: password authentication failed for user "deploy"
FATAL: password authentication failed for user "deploy"
[PDOException]
SQLSTATE[08006] [7] FATAL: password authentication failed for user "deploy"
FATAL: password authentication failed for user "deploy"
Here is my latest .env
config for the database:
DB_CONNECTION=pgsql
DB_HOST=127.0.0.1
DB_PORT=5432
DB_USERNAME=postgres
DB_DATABASE=postgres
DB_PASSWORD=[my password]
DB_SCHEMA=public
As you can see, what is so absurd is that even with the DB_USERNAME
is set to postgres
, the error will still say for user "deploy"
.
I have been googling around and the closest thing, or I thought so, is to update some configuration on /etc/postgresql/9.5/main/postgresql.conf
, which is to make listen_addresses = '*'
. I updated it, restarted postgres service, and still get the exact same error.
Anyone can help me to point out what did I miss?
Thanks.
回答1:
This happens due to caching.
When you run, php artisan config:cache
, it will cache the configuration files. Whenever things get change, you need to keep running it to update the cache files. But, it won't cache if you never run that command.
This is OK for production, since config don't change that often. But during staging or dev, you can just disable caching by clearing the cache and don't run the cache command
So, just run php artisan config:clear
, and don't run the command previously to avoid caching
来源:https://stackoverflow.com/questions/42382075/password-authentication-failed-error-on-running-laravel-migration