3

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.

4
  • 1
    Just a long shot here. not a solution. try to clear your configuration cache. php artisan config:cache. Commented Feb 22, 2017 at 3:24
  • @EddyTheDove that works! But now it seems like I have to clear the cache every time I changed the config. Is there a better solution to this? Commented Feb 22, 2017 at 3:46
  • How often do you actually configurations in a specific environment. Anyway, you can do php artisan config:clear to avoid caching. Commented Feb 22, 2017 at 4:00
  • 1
    You are right, thanks mate! Commented Feb 23, 2017 at 9:43

2 Answers 2

10

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

Sign up to request clarification or add additional context in comments.

1 Comment

This gives me a better understanding about the artisan commands
0

Just lke what @geckob said, its due to caching

When i face the issue, i already upload my laravel project to cpanel already, so instead of running:

php artisan optimize:clear
php artisan optimize

then you will now reupload, just navigate to bootstrap folder, then cache folder, then you will see config file and just delete the config file or rename it then is solved

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.