Change Postgres Password

Change Postgres Password

Problem :-

Need to change the default password for postgres.

Solution :-

1- connect to the database.

2- execute the below steps.

    servicedesk=# \password
   Enter new password : 
   Enter it again : 

3- Once execute it, do the below.

    - Open <SdpHome>\\pgsql\\data\\pg_hba.conf.
    - Search for "IPv4" local connections and find the below content.
  • host    all             all             127.0.0.1/32         trust
  • Change the value "trust" to "md5"
  • Do the same for # IPv6 local connections too.
4- change the DB server and Write the new password for postgres then test the connection and save it.