I’m new to Phoenix/Elixir and Docker.
I’ve been following a tutorial on YouTube where we set up PostgreSQL in a Docker Desktop container and configure it with credentials, then are supposed to plug-in said credentials to our Elixir project dev.exs file. I’ve done all the above and when I run mix ecto.setup (or ecto.create) I get the following output:
11:50:08.883 [error] Postgrex.Protocol (#PID<0.188.0>) failed to connect: ** (Postgrex.Error) FATAL 28P01 (invalid_password) password authentication failed for user "backend_stuff"
11:50:08.920 [error] Postgrex.Protocol (#PID<0.196.0>) failed to connect: ** (Postgrex.Error) FATAL 28P01 (invalid_password) password authentication failed for user "backend_stuff"
** (Mix) The database for ElixirGist.Repo couldn't be created: killed
Here is my dev.exs file:
config :elixir_gist, ElixirGist.Repo,
username: "backend_stuff",
password: "WAOdktQ3rPbPSK3kqPQpask1",
hostname: "localhost",
port: "5432",
database: "elixir_gist_dev",
stacktrace: true,
show_sensitive_data_on_connection_error: true,
pool_size: 10
I’ve tried accessing the Docker container (bs_db) and have successfully authenticated with the credentials above, so it’s not the credentials that are the problem. At ChatGPT’s suggestion, I also modified my “pg_hba.conf” and changed the “METHOD” to md5.
Another suggestion it made was to make the database myself in Docker but if I understand correctly, ecto.create / ecto.setup should handle this step so I’d like to figure out what’s wrong there.
Alex is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.