Home > GNU/Linux, PostgreSql > Cara reset password user postgres di PostgreSQL

Cara reset password user postgres di PostgreSQL


masuk sebagai user postgres dengan perintah su – postgres

edit konfig pg_hba.conf

postgres@coderiver:/opt/framework-3.6.0/postgresql/bin$ vim ../data/pg_hba.conf

ganti:

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

menjadi:

# "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

terus reload

postgres@coderiver:/opt/framework-3.6.0/postgresql/bin$ ./pg_ctl reload
server signaled
LOG:  received SIGHUP, reloading configuration files

run `psql -d template1`

postgres@coderiver:/opt/framework-3.6.0/postgresql/bin$ ./psql -d template1
psql.bin (8.4.0)
Type "help" for help.
template1=#
 

lalu reset dengan perintah alter:

template1=# alter user postgres with password 'wahjangele';
ALTER ROLE
template1=# \q

kembalikan konfig pg_hba.conf ke semula:

postgres@coderiver:/opt/framework-3.6.0/postgresql/bin$ vim ../data/pg_hba.conf

reload:

postgres@coderiver:/opt/framework-3.6.0/postgresql/bin$ ./pg_ctl reload
server signaled
LOG:  received SIGHUP, reloading configuration files

lalu coba dengan password yang baru 🙂

postgres@coderiver:/opt/framework-3.6.0/postgresql/bin$ ./psql
Password:
psql.bin (8.4.0)
Type "help" for help.

postgres=#

referensi:
1. http://www.watters.ws/mediawiki/index.php/Postgres_Reset_Password
2. http://archives.postgresql.org/pgsql-novice/2002-08/msg00072.php

Advertisements
  1. September 24, 2013 at 12:13 pm

    Hello, i believe that i noticed you visited my site so i came to go back the favor?.I’m attempting to in finding things to enhance my website!I suppose its adequate to make use of a few of your concepts!!

  2. October 2, 2013 at 8:11 am

    This is very interesting, You’re an overly skilled blogger. I’ve joined your rss feed and stay up for in the hunt for more of your magnificent post. Additionally, I’ve shared your site in my social networks

  3. October 3, 2013 at 8:27 am

    Yes! Finally someone writes about news.

  4. August 23, 2015 at 9:29 pm

    What’s up, juust wanted to tell you, I liked this post.
    It wwas inspiring.Keep on posting!

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s