Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 7 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • 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.

@kim-cchbc
Copy link

Thanks

@IgorSuvorov
Copy link

IgorSuvorov commented Jan 12, 2022

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

@dnovais
Copy link
Author

dnovais commented Jan 21, 2022

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

@Altobert
Copy link

Altobert commented May 11, 2022

great. So simple so usefull!

@donghoonleekorea
Copy link

it works perfectly!!!

@yfj2090
Copy link

yfj2090 commented Sep 20, 2022

This is a very good solution!!!

@ameer8f26
Copy link

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

@peteraramaldes
Copy link

Hey, I try and received the same error:
image

@arrrrny
Copy link

arrrrny commented Oct 6, 2023

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

@efkango
Copy link

efkango commented Mar 13, 2024

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

yeah its working! thanks

@odi89
Copy link

odi89 commented Apr 8, 2024

Thank you!=)

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