I am try to migrate elixir those days, so I have simple project to create GraphQL API’s with Phoenix. When I start the server like " iex -S mix phx.server", it is throw an error like
[error] Postgrex.Protocol (#PID<0.396.0>) failed to connect: ** (Postgrex.Error) FATAL 28P01 (invalid_password) password authentication failed for user “example_api”
I guess I have to fix somethings about pg_hba.conf.
pg_hba.conf:
# "local" is for Unix domain socket connections only
local all all trust
# IPv4 local connections:
host all all 127.0.0.1/32 trust
# IPv6 local connections:
host all all ::1/128 trust
local replication all trust
host replication all 127.0.0.1/32 trust
host replication all ::1/128 trust
app config:
config :example_api, ExampleAPI.Repo,
username: "example_api",
password: "example_api",
hostname: "localhost",
database: "myExample_api",
show_sensitive_data_on_connection_error: true,
pool_size: 10
mix.ex:
defp deps do
[
{:phoenix, "~> 1.6.6"},
{:phoenix_ecto, "~> 4.4"},
{:ecto_sql, "~> 3.6"},
{:postgrex, ">= 0.16.2"},
{:phoenix_live_dashboard, "~> 0.6"},
{:swoosh, "~> 1.3"},
{:telemetry_metrics, "~> 0.6"},
{:telemetry_poller, "~> 1.0"},
{:gettext, "~> 0.18"},
{:jason, "~> 1.2"},
{:plug_cowboy, "~> 2.5"},
{:absinthe, "~> 1.3.1"},
{:absinthe_plug, "~> 1.3.0"},
{:absinthe_ecto, "~> 0.1.3"}
]
end