Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to mix ecto.create. Multiple errors

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?

like image 759
Jonathan Soifer Avatar asked Jul 12 '26 11:07

Jonathan Soifer


1 Answers

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.

like image 162
Jonathan Soifer Avatar answered Jul 15 '26 11:07

Jonathan Soifer