Steps for setting up a password for PgSQL DB

Steps for setting up a password for PgSQL DB

The steps are verified and tested until 12.4.072. 

We request you to take a VM snapshot or a folder backup of the OpManager server itself (stop the OpManager service) as a first measure.

Below mentioned steps are applicable for Postgres version till 9.2.4*

1. To get the current postgres version, execute the following command in command prompt.

 Example :
  cmd: <OpManagerHome>\pgsql\bin>psql.exe --version 
  Output: psql (PostgreSQL) 9.2.4
2. To change the postgres password follow the steps mentioned below.
  1. Stop the the OpManager service.
  2. Connect to the DB by executing the below mentioned commands one by one in command prompt.
           <OpManagerHome>\bin\startPgsql.bat
           cd 
<OpManagerHome>\pgsql\bin -> psql -U postgres -h127.0.0.1 -p13306 OpManagerDB
           ALTER USER postgres WITH PASSWORD 'new_password';
           
<OpManagerHome>\bin\stopPgsql.bat
3. Changes to be made in pg_hba.conf
  1. Under <OpManagerHome>\pgsql\data\pg_hba.conf, change the line as follows. (Highlighted one)
    # TYPE  DATABASE        USER            ADDRESS                 METHOD
    # IPv4 local connections:
     host    all             all             127.0.0.1/32             
trust




     # TYPE  DATABASE        USER            ADDRESS                 METHOD
     # IPv4 local connections:
     host    all             all             127.0.0.1/32             
md5
4. To generate encrypted password
  • Execute <OpManagerHome>\bin\encryt.bat new_password (encryt.sh new_password - in case of linux)
  • Copy the ENCRYPTED_PASSWORD from the batch output for future use.
5. To change the password in database_params.conf
  1. Open <OpManagerHome>\conf\database_params.conf.
  2. Alter the line # password postgres → password ENCRYPTED_PASSWORD
6. Restart the OpManager service and connect to the DB Query page or perform any operation related to DB. Check if it is working fine.

                  New to ADSelfService Plus?