Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save dnovais/c6c6894b95d764be2aca9736436edd0e to your computer and use it in GitHub Desktop.

Select an option

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.

@kim-cchbc

Copy link
Copy Markdown

Thanks

@IgorSuvorov

IgorSuvorov commented Jan 12, 2022 •

Copy link
Copy Markdown

Hi there. I spent a few hours trying to figure out what to do, your solution is the only one that has worked!

@dnovais

dnovais commented Jan 21, 2022

Copy link
Copy Markdown
Author

I am glad to help @kim-cchbc and @isuvorov1 =D

@Altobert

Altobert commented May 11, 2022 •

Copy link
Copy Markdown

great. So simple so usefull!

@donghoonleekorea

Copy link
Copy Markdown

it works perfectly!!!

@yfj2090

yfj2090 commented Sep 20, 2022

Copy link
Copy Markdown

This is a very good solution!!!

@ameer-pk

Copy link
Copy Markdown

zsh: no such file or directory: /usr/local/opt/postgres/bin/createuser

@peteraramaldes

Copy link
Copy Markdown

Hey, I try and received the same error:
image

@arrrrny

arrrrny commented Oct 6, 2023

Copy link
Copy Markdown

@ameer8f26 and @peteraramaldes It is located here:
/opt/homebrew/opt/postgresql@16/bin/createuser

@efkango

efkango commented Mar 13, 2024

Copy link
Copy Markdown

@ameer8f26 and @peteraramaldes It is located here: /opt/homebrew/opt/postgresql@16/bin/createuser

yeah its working! thanks

@odi89

odi89 commented Apr 8, 2024

Copy link
Copy Markdown

Thank you!=)

@hugorsantos

Copy link
Copy Markdown

Muito bom. Obrigado, me ajudou.

@rizasghari

Copy link
Copy Markdown

You saved my life :)

@mer4lf

mer4lf commented May 20, 2024

Copy link
Copy Markdown

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

@saba-bakhshi

Copy link
Copy Markdown

thank youuuu

@malindupasan

Copy link
Copy Markdown

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

@EasterPeanut

Copy link
Copy Markdown

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