How to check postgres user and password?

My friend made this configuration in my mac. But I do not know the username and password that he chose.

+46
postgresql user
Feb 21 '13 at 17:08
source share
2 answers

You will not be able to find out the password that he chose. However, you can create a new user or set a new password for an existing user.

You can usually log in as a postgres user:

Open a terminal and do sudo su postgres . Now, after entering the administrator password, you can start psql and do

 CREATE USER yourname WITH SUPERUSER PASSWORD 'yourpassword'; 

This creates a new admin user. If you want to list existing users, you can also do

 \du 

to view all users and then

 ALTER USER yourusername WITH PASSWORD 'yournewpass'; 
+85
Feb 21 '13 at 17:14
source share

You can change pg_hba.conf and then reload postgresql. something in pg_hba.conf could be the following:

 # "local" is for Unix domain socket connections only local all all trust # IPv4 local connections: host all all 127.0.0.1/32 trust 

then you change your user to postgresql, you can log in successfully.

 su postgresql 
+3
Feb 22 '13 at 2:41
source share



All Articles