I trying to get an old Phoenix/Elixir app (version 1.13.2-otp-24) to run locally. For some reason it won’t connect to the database when running mix ecto.create.
I’ve changed apps/db/config/config.exs like so:
username: "postgres", password: "postgres", hostname: "localhost", port: "5432"
I’ve started the database like so:
sudo systemctl start postgresql
I’ve checked that the database exists and the postgres username: postgres exists.
When running mix ecto.create I get this error:
12:25:40.934 [error] GenServer #PID<0.808.0> terminating ** (DBConnection.ConnectionError) tcp connect (127.0.0.1:5432): connection refused - :econnrefused (db_connection 2.2.0) lib/db_connection/connection.ex:87: DBConnection.Connection.connect/2 (connection 1.0.4) lib/connection.ex:622: Connection.enter_connect/5 (stdlib 3.17) proc_lib.erl:226: :proc_lib.init_p_do_apply/3 Last message: nil State: Postgrex.Protocol ** (Mix) The database for DB.Repo couldn't be created: killed
I’ve tried changing the password to the postgres default “password”.
I’ve tried different ports, and without the port. Still no luck.
Downgraded the postgres to version 13. The error changed to ^^^.
Problem ended up being a postgres version discrepancy + a missing password.