14

I tried creating a user called postgres. I reinstalled postgres through brew. I'm able to run it with

postgres -D /usr/local/var/postgres

when I run mix ecto.create, I still get the error:

~/code/blog_phoenix:.mix ecto.create
** (Mix) The database for BlogPhoenix.Repo couldn't be created, reason given: psql: FATAL:  role "postgres" does not exist.
~/code/blog_phoenix:.
fhdhsni
  • 1,529
  • 1
  • 13
  • 21
quantumpotato
  • 9,637
  • 14
  • 70
  • 146
  • 2
    This isn't a duplicate question because this is a specific problem specific to the Phoenix framework when starting out. – Gerry Shaw Feb 29 '16 at 03:48

1 Answers1

16

It looks like your database installation is missing the role postgres.

You should try to connect using the default credentials and then execute the SQL statement to create the role and its default database.

In a console run:

$ psql

then

CREATE USER postgres SUPERUSER;
CREATE DATABASE postgres WITH OWNER postgres;
josemrb
  • 2,520
  • 1
  • 20
  • 14