Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

View database user and password in PgAdmin

How do I change a user's password in Postgresql (using PgAdmin) so that I can connect with Rails to the Postgres database using these credentials?

So far: In PgAdmin I right clicked the database name, clicked Create Script and then typed the command:

CREATE USER usr1 WITH PASSWORD 'pwd1!@#$';

Question: where exactly in PgAdmin am I able to see the user and password or list of users and passwords? So far I am unable to see this in Db properties --> 'privileges'?? Any tips on other security elements? or something that can be improved in my current methods? Thanks a lot.

like image 211
Samy Avatar asked May 14 '14 22:05

Samy


3 Answers

Run the query from pgadmin:

SELECT rolname, rolpassword FROM pg_authid;

This requires superuser privileges to protect the password.

like image 163
utkarsh Avatar answered Nov 09 '22 06:11

utkarsh


In the file "pgpass.conf" in this path:

C:\Users\[User's name]\AppData\Roaming\postgresql

Screenshot of Windows Explorer

like image 33
David Martinez Avatar answered Nov 09 '22 06:11

David Martinez


Login roles are common for all databases in a server. You can see them in the bottom of the object browser (left panel). To execute arbitrary SQL query open Query tool (Ctrl-E) from Tools in main menu or click on icon with 'SQL' (previously you have to select a database). To change user password execute SQL:

ALTER ROLE username PASSWORD 'newpassword'

ALTER USER is an alias for ALTER ROLE. Read about it in documentation.

like image 11
klin Avatar answered Nov 09 '22 06:11

klin