Looking for a JavaEE Architect or Potential Tech Co-Founder?
Please don't hesitate to contact me.

Change postgresql's postgres password

This is how you would change your postgresql's user postgres password, in case you forgot it. This is done in ubuntu 12.04.

1.) Logon to your postgres account in behalf of root:
>sudo su postgres
//enter your password
Now you're into postgres

2.) Go into psql
>psql
>alter user postgres with password 


3.) Press ctrl+d and it's done.

I might as well share how to enable remote access to a postgresql server, there are 2 files that should be modified:
1.) listen to a remote ip or all

>sudo vi /etc/postgresql/9.1/main/postgresql.conf
//change listen_addresses='localhost' to listen_addresses='*'
//or specific ip listen_addresses='x.x.x.x'

2.) Allow client authentication
>sudo vi /etc/postgresql/9.1/main/pg_hba.conf
//local
host all all 127.0.0.1/32 trust
//for ipv4
host all all x.x.x.x/24 md5
Change postgresql's postgres password Change postgresql's postgres password Reviewed by Edward Legaspi on Monday, August 13, 2012 Rating: 5

No comments:

Powered by Blogger.