2
votes

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?

1
Apparently your installation is configured to use GSSAPI (e.g. LDAP or Active Directory) you will need to ask whoever installed that what the account's password is. - a_horse_with_no_name
Thank very much. I've installed the Postgres 13 beta version. tried also the postgres 12, always the same. I also always used the same password. is there a possibility to configure installation without gssapi? - Severin Stillhard
Yes, just remove it from pg_hba.conf - a_horse_with_no_name

1 Answers

4
votes

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.