Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SQL

Forgot the password I entered during postgres installation

What I did to resolve the same problem was:

Open pg_hba.conf file with gedit editor from the terminal:

sudo gedit /etc/postgresql/9.5/main/pg_hba.conf
It will ask for password. Enter your admin login password. This will open gedit with the file. Paste the following line:

host  all   all  127.0.0.1/32  trust
just below -

# Database administrative login by Unix domain socket
Save and close it. Close the terminal and open it again and run this command:

psql -U postgres
You will now enter the psql console. Now change the password by entering this:

ALTER USER [your prefered user name] with password '[desired password]';
If it says user does not exist then instead of ALTER use CREATE.

Lastly, remove that certain line you pasted in pg_hba and save it.

Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #Forgot #password #I #entered #postgres #installation
ADD COMMENT
Topic
Name
9+2 =