Postgres Connection Error after MacOS-Update

Hello all,

after updating my Mac to the latest OS-Version (Ventura 13.0.1), the following error appears after running mix phx.server:

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

It worked fine the day before and literally no changes were made :slight_smile:

After running psql -l I can sear the user “postgres”.

This topic seems to be related to the following: 'mix ecto.create' errors with: role "postgres" does not exist, But the solution presented there don’t work for me.

Can anyone help? Did anyone have the same problem ?

Any help is appreciated :slight_smile:

Thanks.

First, how do you installed PostgreSQL ?
In the case you installed it with brew, install or update xcode-command-line utilites, and reinstall PostgreSQL, this might help

Does this work?

1 Like

fully agree, supports different server versions of PostgreSQL, also using docker is an option

Thanks for the reply. I installed it with brew. Reinstall didn’t change anything…

Thank you. I will give it a try. I have it installed but am having some problems starting it up. Will look at it later

In case it is useful to capture this here, we run postgres in docker on our dev machines (both for mix test and for running our application locally), and here are the commands we use to rebuild it:

$ docker rm -fv my-postgres
$ docker run --name my-postgres -p 5432:5432 -e POSTGRES_PASSWORD=postgres -d postgres

and here is how we start psql shell in the container:

$ docker exec -it my-postgres psql -U postgres
psql (14.1 (Debian 14.1-1.pgdg110+1))
Type "help" for help.

postgres=#

or, to immediately connect to the db:

$ docker exec -it my-postgres psql -U postgres my_db_dev
1 Like

Best if you can reinstall Postgres in-situ; macOS upgrades are known to wreak havoc with third party software. Once reinstalled, you can verify that the system works and the role exists via psql.

Thank you, reinstall did work after the second try :slight_smile:

It is a bit annoying that updating the OS-Version leads to such problems…

fwiw I’ve been using https://postgresapp.com for pretty much a decade - same install - multiple upgrades (both OS and postgres(app)) - never any issue… so highly recommended…

1 Like