cameron g
cameron g

Reputation: 31

postgres error when starting Phoenix server

I Just made a new app in phoenix. Im following along with the Programming Phoenix book. I am on chapter 3 and after making the files and using:

mix phoenix.server

I get an angry red error saying:

[error] Postgrex.Protocol (#PID<0.234.0>) failed to connect: ** 
(Postgrex.Error) FATAL 28000 (invalid_authorization_specification): 
role "postgres" does not exist

it keeps repeating this over and over.

Upvotes: 0

Views: 836

Answers (1)

Azul
Azul

Reputation: 581

Edit: Changes made to reflect comments.

This will delete all local databases

  1. rm -rf /usr/local/var/postgres && initdb /usr/local/var/postgres -E utf8

  2. sudo -u <your local username> psql postgres

  3. CREATE USER postgres SUPERUSER;

  4. CREATE DATABASE postgres WITH OWNER postgres;

This simply creates the Postgres user

  1. psql -U postgres

  2. CREATE USER postgres;

Thanks @Dogbert, @mudasobwa

Upvotes: 4

Related Questions