Skip to content

Instantly share code, notes, and snippets.

@dasgoll
Created March 6, 2015 17:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save dasgoll/577dfa86b05c3e05569a to your computer and use it in GitHub Desktop.
Save dasgoll/577dfa86b05c3e05569a to your computer and use it in GitHub Desktop.
How to Change password for PostgreSQL user 'ambari' - default password is 'bigdata'
/etc/init.d/ambari-server stop
# enable password-less login for user 'postgres'
vi /var/lib/pgsql/data/pg_hba.conf
change 'local all postgres ident' to 'local all postgres trust'
/etc/init.d/postgresql restart
psql -U postgres
postgres=# alter user ambari with password 'NEWPASSWORD';
revert changes back in '/var/lib/pgsql/data/pg_hba.conf'
/etc/init.d/postgresql restart
change password in /etc/ambari-server/conf/password.dat
/etc/init.d/ambari-server start
@kikithegecko
Copy link

Although my pg_hba.conf was located in /etc/postgresql, this worked like a charm. Thank you!

@gajaka
Copy link

gajaka commented Jul 19, 2016

Hi dasgoll
I have installed postgresql-9.4 and did the following
service postgresql stop
service postgresql-9.4 initdb
service postgresql-9.4 start
sudo su - postgres
cd /var/lib/pgsql/9.4/data
vi postgresql.conf
change (uncomment):
listen_addresses = 'localhost' # what IP address(es) to listen on;
TO
listen_addresses = '*'

vi pg_hba.conf

change line to have md5:
replace with:

TYPE DATABASE USER CIDR-ADDRESS METHOD

"local" is for Unix domain socket connections only
local all all trust
IPv4 local connections:
host all all 127.0.0.1/32 trust
IPv6 local connections:
host all all ::1/128 trust
host all boss 0.0.0.0/0 md5

  1. restart:
    sudo service postgresql-9.4 restart

However I was not able to login on ambari because I didn't tell ambari to use
postgresql-9.4. Can you please advice ?

Many thanks

Dragan

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment