nativeInstallersonarqube

Modify the default administrator password

Before running the commands shown on this page, you should load the Bitnami stack environment by executing the installdir/use_APPNAME script (Linux and MacOS) or by clicking the shortcut in the Start Menu under “Start -> Bitnami APPNAME Stack -> Application console” (Windows). On OS X VMs, the installation directory is /opt/bitnami and OS X VM users can click the “Open Terminal” button to run commands. Learn more about the Bitnami stack environment and about OS X VMs.

NOTE: The Approach A sections referred to below do not apply to Bitnami native installers. Users of Bitnami native installers should refer only to the Approach B sections.

Change the PostgreSQL password

You can modify the PostgreSQL password using the following command at the shell prompt:

$ psql -U postgres
postgres=# alter user postgres with password 'NEW_PASSWORD';
postgresl=# \q

Reset the PostgreSQL password

If you don’t remember your PostgreSQL database password, you can follow the steps below to reset it to a new value:

  • Change the authentication method in the PostgreSQL configuration file pg_hba.conf from md5 to trust and reload the configuration.

    • Approach A (Bitnami installations using system packages):

        $ sudo sed -ibak 's/^\([^#]*\)md5/\1trust/g' installdir/postgresql/conf/pg_hba.conf
        $ sudo -u postgres pg_ctl reload
      
    • Approach B (Self-contained Bitnami installations):

        $ sudo sed -ibak 's/^\([^#]*\)md5/\1trust/g' installdir/postgresql/data/pg_hba.conf
        $ sudo -u postgres pg_ctl reload
      
  • Connect to the PostgreSQL database and set the password to a new value:

      $ psql -U postgres
      postgres=# alter user postgres with password 'NEW_PASSWORD';
      postgresl=# \q
    
  • Finally, change the authentication method back to md5 and reload the old PostgreSQL configuration:

  • Approach A (Bitnami installations using system packages):

          $ sudo sed -i 's/^\([^#]*\)trust/\1md5/g' installdir/postgresql/conf/pg_hba.conf
          $ sudo -u postgres pg_ctl reload
    
    • Approach B (Self-contained Bitnami installations):

        $ sudo sed -i 's/^\([^#]*\)trust/\1md5/g' installdir/postgresql/data/pg_hba.conf
        $ sudo -u postgres pg_ctl reload
      

You should now be able to connect to PostgreSQL with the new password.

Last modification June 16, 2021