Starting pgAdmin III with stored passwords asks for password again - postgresql

Starting pgAdmin III on kubuntu with stored password asks for password every time connecting to database giving error "Error connecting to the server: fe_sendauth: no password supplied". It ignores checkbox in store password field.

I found reason for this in Postgresql mailing lists. Problem is when file /home/user/.pgpass has permisions more than u=rw 0600 pgAdmin ignores the file. Changing permisions for file resolves problem.

Related

cannot connect to Postgres - password unknown

I can't connect on postgresql.
when i go on pgadmin>server>postgresql, it asked me "please enter the password for the user 'postgres' to connect the server?
I have windows 10 and postgresql 14.
But I don't have this password.
What can I do?
The following worked for me.
Change METHOD of all rows in your pg_hba.conf file from scram-sha-256 to trust (C:\Program Files\PostgreSQL\14\data\pg_hba.conf). This will disable password for your DB.
Click on any database in postgresql to use Query Tool.
In Query Tool type ALTER USER postgres WITH PASSWORD 'User_password';
postgres is default username, execute it.
This way you can set up a password for your DB, after that go back to the first step and change it back from trust to scram-sha-256.

Changing password of postgres user led imidiate prompt of wrong password without providing a password

So I forgot the password of the postgres user on my PostgreSQL server. I then changed all the md5 settings in the pg_hba.conf file to trust, restarted the server and then changed the password of the postgres user using ALTER USER postgres.... Now I changed the trust settings back to md5, restarted the server again, but when I now want to perform psql -U postgres it immediately returns an error:
psql: FATAL: password authentication failed for user "postgres"
password retrieved from file "/root/.pgpass"
without asking me to enter any password. The .pgpass file has the following line in it:
*:*:*:postgres:SOME_HASH
EDIT:
Somehow this only appears when logging in as root to my server... With my other user it works just fine...
The immediate solution is to remove the .pgpass file that contains the wrong password. If you didn't create that file yourself, odds are that pgAdmin did that for you when you told it to save the password.
If you specify '-W', then psql will prompt you for a password and ignore the .pgpass file. But why not fix .pgpass, or if you aren't using it, then remove it?

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?
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 :
Connect to the terminal as the user 'postgres' with the current admin credential (thanks sudo)
sudo -u postgres -i
Connect to the database 'postgres'
psql postgres
(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
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.
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 :)

I can connect to my database through pgadmin, but I cannot connect to the database using terminal(psql)

I created a database using the GUI of pgadmin and it works well. I can connect to the server with my password. But when I want to connect to the database using psql in terminal, after I enter the password, it says
psql: FATAL: password authentication failed for user "{username}"
I tried every possible password, but it's still not working.
Has anyone meet this issue before?

postgresql data directory not connecting

I am using windows 8.
My Postgres was Correct.
I just took the data directory from C:/postgresql/8.3/
Now database was connected through command prompt.
When I was trying to connect using pgadmin, it's saying
FATEL: error
An error has occured:
Error connecting to sthe server: FATAL: role "postgres" is not permitted to log in
I changed the required things in pg_hba.conf (trust) and postgresql.conf (connection *) (port 5433)
But, still I was unable to connect the database.
How to give the permissions to postgres role.
when am trying to give the permissions through cmd also it's giving same error.
I was tried in so many ways
but, still I didn't get the database.
It looks like you might have accidentally revoked the LOGIN and SUPERUSER rights from the postgres user. Perhaps you created a superuser with a different name instead? Log in as that user if you did.
If not, and you can't get access as user postgres, you will need to start the database engine up in single-user mode and manually GRANT the SUPERUSER right to postgres again. This is much the same process as is required when recovering from a dropped (deleted) superuser account.
See related:
https://dba.stackexchange.com/q/44586/7788
Postgres reset password in PostgreSQL server 8.4
BTW, 8.3 is a very old and unsupported version. Plan your upgrade promptly.
If there's no data in PostgreSQL that you care about, the easiest thing to do will be:
Uninstall PostgreSQL 8.3;
Delete C:\Program Files\PostgreSQL\8.3 (permanently and unrecoverably destroying all data in your PostgreSQL databases); and
Install a current PostgreSQL version