-
Notifications
You must be signed in to change notification settings - Fork 468
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
psql: FATAL: password authentication failed for user "postgres" #112
Comments
v10, still reproduced. Solution is: You need to define a password for user postgres
Then you may grant other users as superuser and etc. (Make your volume persist) Container Mgmnt:
|
@zalper how should i save your steps in the container!! |
I had a similar issue, probably not related to the one of @zalper but with the same error message so I'll leave the solution here for anyone having the same problems. I'm using Windows and had ProstgreSQL 12 installed. At the same time I tried to run a postgres:10 docker container. When I tried to connect to the database running in the docker container using The issue was that the postgres docker container was using the default port Solutions:
|
@eddex Just wanted to chime in to say your Option 1 above fixed this for me after I had been scratching my head for a couple of hours. That solution does not appear anywhere else online that I have been able to find and was extremely helpful. Thanks! |
@eddex Thanks! I also benefited from you recalling your problem and solution. I'd not seen it mentioned anywhere else in 2 days of troubleshooting. I had noticed double use of the port in some netstat results, but reasoned it away as being 2 references to the same process since I didn't know postgres 12 was running on my PC. Bad assumption on my part :) |
@eddex Thanks a lot. I was having the same issue with my local Postgres installation and the container I was running by using docker. I just stopped the service on Windows and started working. |
@eddex also saved the day for me here. |
@eddex - after a couple of hours of struggle, this answer helped me. |
/remind me about this on saturday |
@sameersbn set a reminder for May 30th 2020 |
👋 @sameersbn, about this |
@eddex |
I still got the issue and really don't know what changed. After moving to my working machine I removed the containers and images for postgres:12 from my home machine. Now I want to set the things up again but for some reason it refuses to log me. Haven't changed any docker-compose settings. This is my docker-compose.yml file.
I don't have postgres installed directly on my machine, tried to change ports, passwords, adding networks, re-pulling images, restarting docker etc. and it just won't work. Any ideas anyone? |
Today, I have decided to try and re-create the volume. So I deleted this postgres-v12 and created a new one and just in case I named it postgres12. I updated docker-compose.yml and voila everything started working again. I have never done any manual user updates, so somehow something messed up the postgres user in that volume. |
Thanks @eddex ! Solution 1 fixed my issue. |
Do you maybe also know a solution for Mac OSX? I already spent hours on this bad connection error for this docker issue... |
In my case (dockerizing a rails app) I had to delete |
almost went crazy because I have tried even reinstalling docker to solve this issue, turns out it was because I forgot I installed a local postgresql. 🤪 thanks @eddex |
It worked for me as well |
I had the same issue with just running and see what images you currently have. Removing the postgres:latest image I had locally and re-running the command ended up with the latest image being pulled and the login working! |
this worked for me... i just forward and expose 5435 on my machine. leave pg on 5432 inside the container. Then it's easy to config 5435 or any other port for dev use.
my database.env for reference
yes it's been redacted. i am not actually forcing the default values. just wanted to clarify the file structure and proper envs as noted here: https://www.postgresql.org/docs/9.3/libpq-envars.html in addition to the others the docker container uses. there seems to be no reason for 2 different sets of envs, but i haven't thought through every use case. so perhaps that's a possible fix here is using the core PG envs and then update container docs to match. |
You are so beautiful, THANKSS |
You saved me tons of painful 72hours of battle with innocent Intellij IDE and plugins |
Faced the same issue. Solved it by changing port mapping on docker-compose services:
db:
image: postgres
container_name: postgres
restart: always
environment:
POSTGRES_PASSWORD: ***
POSTGRES_USER: ***
POSTGRES_DB: ***
ports:
- 5435:5432 ==> changed 5432 to 5435 |
Same issue |
@gustavorps I think the solution is an easy one to work around. Using @JustifydWarrior's fix above:
5433 and 5434 are also reserved for more common uses, however 5435 is not a very common protocol by definition & is most often used as a second postgres port. @bibhuticoder came up with the same solution. I think someone should submit a PR to fix this, even if it is a second docker compose file, simply called by using the filename flag. Disabling the default service, is the simplest solution, but that shouldn't be the preferred workaround, many of us need both running. |
I had the same problem . My solution for windows :
I solved my problem with this way . |
My english is not very well, but i try help you. In your project run ls -a if exist a folder called database-data (name of the your volume of postgres of the docker-compose.yml), remove this folder and run again docker-compose up -d --force-recreate The my work this way. Or docker volume rm $(docker volume ls -q) and run again |
Below is my postgres:14 in the docker-compose.ymlI am writing Go Program in the microservice manner. The folder /db-data/postgres/ which I mentioned below has content populated by docker. postgres: |
THanks it works for me |
A uppercase character in the username will also trigger this error message... |
Stopping the postgres service and uninstalling from Windows was my exact issue |
This work for me, thank you! |
@eddex after two days of reading all of these forums, I finally found your solution, you saved my life hahaha Thanks my brotha!! |
This answer save my time twice, once in my local, weeks later on my server. Thank you! |
… for ex:5500 because local postgres also use 5432 ,solution link:sameersbn/docker-postgresql#112 (comment)
For me, creating a new volume in docker-compose.yml by changing it in the |
This worked for me, but why did it work? I'm scared and disoriented. |
I was having the same issue! Here is how I solved it!
|
thanks, it worked! |
Thnx so much, spent hours on a port error 😭 |
In my case, the database password contains special symbols, e.g. |
It has been two days debugging this with success and your comment solved it to me. Thanks |
Bro just run docker on another port like 5433, use - $ sudo docker run --name postgresql -itd --restart always --env 'PG_PASSWORD=postgres' --env 'PG_TRUST_LOCALNET=true' --publish 5433:5432 ... It worked for me :) |
Changing the
you will use |
IN MY CASE, I had to check the container's ip address and sync it with the .env file.
IF DIDN'T WORK:
IF NOT SOLVED YET:
|
Since above solutions are of the sort "X worked for me", I did some testing and the issue is not with the way the Dockerfile for PostgreSQL is written, but with the container first being created with incorrect/empty credentials and then reused without changes. If you're running into issues despite having a correct Docker or docker-compose setup
|
This is the root cause for the problem if anyone wondering .. |
Thanks man, helped a lot |
This is my docker-compose.yml file services: order_db_server: catalog_db_server I am able to connect but order_db_server is throwing " FATAL: password authentication failed for user order_db". I tried stopping |
If none of the above helped and you were sure that the port is free, you might consider removing all of your volumes, and turn on your containers again. I faced the same issue and removing the volumes brought me back on track!
|
Also make sure you use the correct format;
|
The text was updated successfully, but these errors were encountered: