Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save dnovais/c6c6894b95d764be2aca9736436edd0e to your computer and use it in GitHub Desktop.
Save dnovais/c6c6894b95d764be2aca9736436edd0e to your computer and use it in GitHub Desktop.
Fixing error - psql: FATAL: role “postgres” does not exist

Corrigindo o erro psql: FATAL: role “postgres” does not exist

1 - Instalar o postgresql

brew install postgresql

2 - Startar o postgresql

brew services start postgresql

Ao rodar o comando para acessar o postgresql:

psql -U postgres

E o erro for disparado: "psql: FATAL: role “postgres” does not exist"

Para corrigir:

/usr/local/Cellar/postgresql/<version>/bin/createuser -s postgres

ou

/usr/local/opt/postgres/bin/createuser -s postgres

Dessa forma é criado o usuário postgresql e você poderá ter acesso.

@mer4lf
Copy link

mer4lf commented May 20, 2024

help me please, idk how to fix
Снимок экрана 2024-05-20 в 2 58 56 PM

@saba-bakhshi
Copy link

thank youuuu

@malindupasan
Copy link

/usr/local/opt/postgresql@11/bin/createuser -s postgres try this
@mer4lf

@EasterPeanut
Copy link

For newer homebrew versions:

/opt/homebrew/opt/postgresql@16/bin/createuser -s postgres

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment