What to do if password authentication fails in Docker/Postgres

error contents

Unable to connect to the database.
error: password authentication failed for user "xxx"

Or

Password does not match for user “xxx”

Cause

--This occurs when you change the authentication information (POSTGRES_USER or POSTGRES_PASSWORD) after launching Docker once.

--Credentials are set at initial startup. After that, even if you try to start by changing the authentication information, an error will occur because it does not match the initially set value.

How to respond

--Delete db volume and start it (* Note that the data in db volume will be lost).

##Remove docker
$ docker rm <xxx>

$ docker volume ls
DRIVER    VOLUME NAME
local     some_db_data

$ docker volume rm <volume>
or
$ docker volume prune
WARNING! This will remove all local volumes not used by at least one container.
Are you sure you want to continue? [y/N] y 

##Confirm that it has been deleted
$ docker volume ls

Reference

https://stackoverflow.com/questions/54764965/password-does-not-match-for-user-postgres

Recommended Posts

What to do if password authentication fails in Docker/Postgres
What to do if you forget the root password in CentOS7
What to do if the debug gem installation fails
What to do if build from command line fails in Android development environment
What to do if ffi installation fails when launching an application in Rails
[Rails] What to do if data is not registered in DB
What to do if Cloud9 is full in the Rails tutorial
What to do if you install Ubuntu
What to do if you get an error in Basic authentication during Rails test code
What to do if you get a groovy warning in Thymeleaf Layout
What to do if the prefix c is not bound in JSP
What to do if deployment fails on Heroku (Ruby app not detected)
What to do if tomcat process remains when tomcat is stopped in eclipse
What to do if the server tomcat dies
What to do if you push incorrect information
What to do when IllegalStateException occurs in PlayFramework
What to do if the changes are not reflected in the jar manifest file
What to do if Docker Desktop fails to launch on your M1 MacBook Pro
What to do if the Rails server can't start
What to do if you accidentally create a model
What to do if an ActionController :: UnknownFormat error occurs
What to do if you get a wrong number of arguments error in binding.pry
What to do if you can't get the text of an element in Selenium
What to do when Method not found in f: ajax
What to do if audio is not available on discordrb
What to do if FacesMessage is set but not displayed
# What to do if you accidentally do rails db: migrate: drop
What to do if the adb command cannot be executed
What to do if mysql2 gets a bundle install error
What to do if you can't use the rails command
[Rails] What to do if you accidentally install bundle in the production environment in your local environment
What to do if you get a "302" error in your controller unit test code in Rails
[Ubuntu 20.04] What to do if the external monitor is not recognized
What to do if validation doesn't work with the update action
Notes on what to do if Ubuntu 20.04 installation on Virtual box 6.1 (Windows10) fails with "Error 5 Input / output error"
What to do when the changes in the Servlet are not reflected
What to do if you get a "Mysql2 :: Error: Operand should contain 1 column (s)" error in Rails
[Note] What to do if bundle install in Chapter 3 of the rails tutorial is not possible
What to do if the Eclipse Maven dependency Jar is wrong
What to do if an SSH key authentication error occurs during automatic deployment to EC2 with Capistrano
What to do after Vagrant install
What to do if you get angry with OpenSSL with pyenv install
What to do if you get a JNI shared library error when trying to build in Eclipse
[Logback] What to do if unnecessary files do not disappear during rotation
What to do if you get an [An HTTP request took too long to complete.] Error in Docker.
What to do when javax.batch.operations.JobStartException occurs
What to do if you cannot roll back the migration (UnknownMigrationVersionError)
[Rails] What to do if you can't get parameters with form_with
What to do if an error occurs when doing npm install axios in React + Typescript project
What to do if you get an error with bundle install by entering gem'bcrypt' in your Gemfile
What to do if the image posted by refile disappears after setting a 404 error page in Rails
What to do if you can't bundle update and bundle install after installing Ruby 3.0.0 in the Rails tutorial
What to do if Operation not permitted is displayed when you execute a command in the terminal
What to do if changes are not reflected after automatic deployment to EC2
Add gem'rails-i18n','~> 6.0.0' and what to do if bundle install gives an error
What to do if you get an error during rails db: reset
[Composer] [Laravel] What to do if you cannot install due to insufficient memory
What to do if you get an uninitialized constant Likes Controller error
What to do when Blocked Host: "host name" appears in Ruby on Rails
What to do and how to install when an error occurs in DXRuby 1.4.7
What to do if an error occurs when nokogiri enters when bundle install