3

When trying to run mix ecto.create I got the following errors:

  1. .Repo couldn't be created: tcp connect: connection refused - :econnrefused
  2. .Repo couldn't be created: FATAL (invalid_authorization_specification): role "postgres" does not exist
  3. .Repo couldn't be created: FATAL (invalid_authorization_specification): role "postgres" is not permitted to log in

What are the conditions that Postgres must meet in order to properly setup Phoenix?

Jonathan Soifer
  • 2,715
  • 6
  • 27
  • 50

2 Answers2

3

In order to run mix ecto.create you need a series of conditions:

  1. Postgres must be up and running.

  2. Postgres must have a user postgres with the password postgres.

  3. The postgres user must have permissions to both LOGIN and CREATEDB.

I, for instance, had Postgres running locally but was missing the postgres user.

So within PSQL I had to use the following command:

# CREATE ROLE postgres LOGIN CREATEDB PASSWORD 'postgres';

And then it worked.

Kudos to Wendy Smoak.

Jonathan Soifer
  • 2,715
  • 6
  • 27
  • 50
0
  1. start your postgres: (assuming you are using a mac)

    pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start

You can then change in cofig/dev.exs the database config at the bottom to use your account with role able to create a db.

JFAP
  • 3,617
  • 1
  • 24
  • 25