Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Changing passwords in the .env file produces failure to authenticate with postgres user #1821

Answered by ghost
DaBisounours asked this question in Questions
Discussion options

Hello,

I have been trying to change passwords in the production server with the help of the .env file.
Though there is a problem in the backend due to a failure to authenticate with the postgres user after changing the database password.

psql: FATAL: password authentication failed for user "postgres"
FATAL: password authentication failed for user "postgres"

Isn't that all I am supposed to do to change passwords ?

Thanks in advance.
Evan

You must be logged in to vote

Hello ! I got the same problem and for me it was due to the volume creation of docker you can check that with :

docker volume ls

I'm not an expert in Docker but I think if you change the password in the .env it does not create a new volume or use the old one to connect with your new password and that will obviously not work.

From this constatation you have 2 solution the first one is more or less "brutforce" and it worked for me the second one is maybe more smart but i didn't test it:

  1. Delete the old volume and build the image again with docker-compose

docker volume rm <old_db_volume_id>

or to delete every single volume

docker volume rm $(docker volume ls)

then build your project i...

Replies: 6 comments

Comment options

Hello ! I got the same problem and for me it was due to the volume creation of docker you can check that with :

docker volume ls

I'm not an expert in Docker but I think if you change the password in the .env it does not create a new volume or use the old one to connect with your new password and that will obviously not work.

From this constatation you have 2 solution the first one is more or less "brutforce" and it worked for me the second one is maybe more smart but i didn't test it:

  1. Delete the old volume and build the image again with docker-compose

docker volume rm <old_db_volume_id>

or to delete every single volume

docker volume rm $(docker volume ls)

then build your project image again

docker-compose up -d

  1. Access to the pg admin or directly form the shell (with docker commands) to access to your db_user and change the password (I didn't test is with docker but I've already done this on a running server I don't remember the commands tho)

Hope this will help you :) Do not hesitate to correct me or complete my answer

You must be logged in to vote
0 replies
Answer selected by YuriiMotov
Comment options

Just upvoting that I ran into the same issue today, I think even a simple clarification on the readme would be a nice patch as a troubleshooting step.

You must be logged in to vote
0 replies
Comment options

We ran into the same issue.

You must be logged in to vote
0 replies
Comment options

你好,

我一直在嘗試借助 .env 檔案來更改生產伺服器中的密碼。 但由於更改資料庫密碼後無法與 postgres 使用者進行身份驗證,導致後端出現問題。

psql: FATAL: password authentication failed for user "postgres"
FATAL: password authentication failed for user "postgres"
這不是我要做的就是更改密碼嗎?

提前致謝。 埃文

You must be logged in to vote
0 replies
Comment options

你好,

我一直在嘗試借助 .env 檔案來更改生產伺服器中的密碼。 但由於更改資料庫密碼後無法與 postgres 使用者進行身份驗證,導致後端出現問題。

psql: FATAL: password authentication failed for user "postgres"
FATAL: password authentication failed for user "postgres"
這不是我要做的就是更改密碼嗎?

提前致謝。 埃文

抱歉..剛下班,不太會用,搞了好久才...

You must be logged in to vote
0 replies
Comment options

I ran into the same issue after modifying the default password for PG, deleting the db volume manually and rerunning docker compose watch resolved the issue.

Hello ! I got the same problem and for me it was due to the volume creation of docker you can check that with :

docker volume ls

I'm not an expert in Docker but I think if you change the password in the .env it does not create a new volume or use the old one to connect with your new password and that will obviously not work.

From this constatation you have 2 solution the first one is more or less "brutforce" and it worked for me the second one is maybe more smart but i didn't test it:

1. Delete the old volume and build the image again with docker-compose

docker volume rm <old_db_volume_id>

or to delete every single volume

docker volume rm $(docker volume ls)

then build your project image again

docker-compose up -d

2. Access to the pg admin or directly form the shell (with docker commands) to access to your db_user and change the password (I didn't test is with docker but I've already done this on a running server I don't remember the commands tho)

Hope this will help you :) Do not hesitate to correct me or complete my answer

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Converted from issue

This discussion was converted from issue #344 on September 01, 2025 16:24.

AltStyle によって変換されたページ (->オリジナル) /