2

In my dev env I have postgres running in a container, running db:migrate worked fine until recently I needed to change the schema to sql

config.active_record.schema_format = :sql

Not when I run db:migrate I get the following error:

pg_dump: [archiver (db)] connection to database "mydatabase" failed: FATAL:  password authentication failed for user "myuser"

Looks to me that pg_dump ignores the database.yml settings. Anyone else had any luck with this kind of setup?

1 Answer 1

2

What I ended up doing is install postgresql-client-common and postgresql-client, in ubuntu you use:

sudo apt install postgresql-client-common postgresql-client

This gave me pg_dump locally, then I've opened a terminal in the docker machine and add host all all 0.0.0.0/0 trust to the default pg_hba.conf file

To open a shell use:

docker exec -i -t <idOfContainer> /bin/bash

To add the line:

cd /var/lib/postgresql/data
echo host all all 0.0.0.0/0 trust >> pg_hba.conf

The last step is that you will need to add your local user to postgress, pg_dump will not use the credential from datbaase.yml so you should connect to psql and run:

CREATE USER <youruser>
Sign up to request clarification or add additional context in comments.

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.