AstonJ
'mix ecto.create' errors with: role "postgres" does not exist
Just posting this here in case it helps anyone else in future.
on mix ecto.create I was getting:
00:54:48.033 [error] GenServer #PID<0.214.0> terminating
** (Postgrex.Error) FATAL 28000 (invalid_authorization_specification) role "postgres" does not exist
(db_connection) lib/db_connection/connection.ex:84: DBConnection.Connection.connect/2
(connection) lib/connection.ex:622: Connection.enter_connect/5
(stdlib) proc_lib.erl:249: :proc_lib.init_p_do_apply/3
Last message: nil
State: Postgrex.Protocol
** (Mix) The database for Hello.Repo couldn't be created: killed
and psql was reporting:
psql: FATAL: database "Aston" does not exist
See answer below…
Marked As Solved
AstonJ
Fixed with:
createdb 'Aston'
psql
(Change Aston to whatever the psql command in the post above said was missing)
Then:
CREATE USER postgres SUPERUSER;
CREATE DATABASE postgres WITH OWNER postgres;
exit
(Although it told me the postgres db already exists - something you can check with psql -l)
mix ecto.create
$ The database for Hello.Repo has been created
![]()
Also Liked
GenericJam
/usr/local/opt/postgres/bin/createuser -s postgres
Fixed it for me. The problem is homebrew doesn’t install the postgres user.
sbuffose
Hi guys! I got the same error:
16:05:28.295 [error] GenServer #PID<0.220.0> terminating
** (Postgrex.Error) FATAL 28000 (invalid_authorization_specification) no PostgreSQL user name specified in startup packet
(db_connection) lib/db_connection/connection.ex:84: DBConnection.Connection.connect/2
(connection) lib/connection.ex:622: Connection.enter_connect/5
(stdlib) proc_lib.erl:249: :proc_lib.init_p_do_apply/3
Last message: nil
State: Postgrex.Protocol
** (Mix) The database for Getaways.Repo couldn't be created: killed
and fixed it. It was due to the config on the dev.exs file (at the end of it):
Originally:
# Configure your database
config :getaways, Getaways.Repo,
username: "postgres",
password: "postgres",
database: "getaways_dev",
hostname: "localhost",
pool_size: 10
Fixed:
# Configure your database
config :getaways, Getaways.Repo,
username: "yourcomputeruser",
password: "yourcomputeruser",
database: "getaways_dev",
hostname: "localhost",
pool_size: 10
The setup by default is “postgres” => updated them to my computer user.
I hope it helps!
dimitarvp
That’s kind of weird. PostgreSQL should always come with a created postgres user. I’d wager on a broken installation.
Popular in Questions
Other popular topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #advent-of-code
- #elixirconf-us
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #security
- #performance









