Severin Stillhard
Severin Stillhard

Reputation: 91

Fatal: password authentication failed for user "postgres" macos

I'm using PostgreSQL for the first time and I am not familiar with it. When I start pgadmin and enter master password and when I want to connect to postresql and again enter same password following error pops up:

could not connect to server: could not initiate GSSAPI security context: The operation or option is not available could not initiate GSSAPI security context: Credential for asked mech-type mech not found in the credential handle FATAL: password authentication failed for user "postgres"

Whats the problem here?

Upvotes: 9

Views: 20810

Answers (2)

Ahmet
Ahmet

Reputation: 19

It is ridiculous but my solution after many trial was very very simple.

Problem seems that password is not match or connection problem. So, first make sure your password is definitely correct. You might think you enter exact same but it might be not. I tried to wrote a password to somewhere else that i can see it is correct.Then, i copied that and paste it to setup where you put your new password. Ofcourse you have to remove postgre completely for this to try.

When setup is completed, if you tried and didn't work again, then delete Postgre server and create new one. Just enter server name, connection address and password and save. if this one also not work successfully,maybe you should check if the chosen port number is alive or not for postgre server.

Sorry for that answer is not visual and some english mistakes. I just wanted to wrote really fast. Good luck :)

Upvotes: 0

erde
erde

Reputation: 140

I just had the same issue and below is how I solved it. Because you don't have a default password for the user 'postgres', you will need to set one first, like this :

  1. Connect to the terminal as the user 'postgres' with the current admin credential (thanks sudo)

    sudo -u postgres -i
    
  2. Connect to the database 'postgres'

    psql postgres
    
  3. (optional) If the psql command is not found, you can the PostgreSQL bin path to your $PATH like this :

    export PATH=$PATH:THE_PATH_TO_POSTGRESQL_BIN_FOLDER
    # Example : export PATH=$PATH:/Library/PostgreSQL/12/bin
    
  4. Change the password of the user 'postgres'

    --- Do not forget to my_password with the desired password
    ALTER USER postgres PASSWORD 'my_password';
    

In the pgAdmin windows, try to connect with this new password, it should work.

Upvotes: 14

Related Questions