# SonarQube - change databases default passwords

**URL:** <https://community.sonarsource.com/t/sonarqube-change-databases-default-passwords/43423>\
**Category:** SonarQube Server / Community Build\
**Tags:** upgrade, docker, sonarqube\
**Created:** [May 19, 2021, 8:34am UTC](https://community.sonarsource.com/t/sonarqube-change-databases-default-passwords/43423 "2021-05-19T08:34:45Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![SprOS](https://avatars.discourse-cdn.com/v4/letter/s/97f17d/32.png) [@SprOS](https://community.sonarsource.com/u/SprOS)\
**Post date:** [May 19, 2021, 8:34am UTC](https://community.sonarsource.com/t/sonarqube-change-databases-default-passwords/43423/1 "2021-05-19T08:34:45Z")

</div>

Hello,

I’m reaching out to you with a problem regarding JDBC, Postres passwords. I started to add some projects to SonarQube but I haven’t changed the default passwords to the databases.

Is there a way to change `SONAR_JDBC_PASSWORD`, `POSTGRES_PASSWORD` afterwards, just to get it more secure?

- which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)  
SonarQube - 8.9  
Docker compose yml

- what are you trying to achieve  
Change `SONAR_JDBC_PASSWORD`, `POSTGRES_PASSWORD` default passwords after I already analysed projects inside SonarQube.

- what have you tried so far to achieve this  
Trying to change JDBC, Postgres passwords

**For Postgres**

1. Access postgres db container & connect to the database with user `sonar`
2. Change username password using `\password sonar`
3. Update docker .yml with the new password and restart SonarQube  
**Result** : db connection failed

**For JDBC**

1. Open h2 shell using `java -cp h2-1.3.176.jar org.h2.tools.Shell` and update Driver, URL, user, password
2. Update docker .yml with the new password and restart SonarQube  
**Result** : db connection failed

I will appreciate any help to change these passwords.

---

<div class="post-metadata">

**Author:** ![Tobias\_Trabelsi](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/tobias_trabelsi/32/31755_2.png) [@Tobias\_Trabelsi](https://community.sonarsource.com/u/Tobias_Trabelsi)\
**Post date:** [June 2, 2021, 6:17am UTC](https://community.sonarsource.com/t/sonarqube-change-databases-default-passwords/43423/2 "2021-06-02T06:17:32Z")

</div>

Hi @SprOS and welcome to the community 👋

i am not really sure what you are trying to do with the h2 database or what exactly you mean with docker.yml, so it would be great if you could elaborate a little about your setup and configuration.

in general when you want to change the database password the process for docker-compose (i assume this because you were mentioning a docker.yml) is as follows:

- shutdown sonarqube
- change database password on your database
- update `SONAR_JDBC_PASSWORD` in your `docker-compose.yml`
- let docker-compose restart the container.

SQ is persisting all data in the connected database, so you are free to change your DBMS username/password as often as you like.  
Moving from the embedded database (h2) to postgres on the other hand is unsupported.

hope that helps

---

<div class="post-metadata">

**Author:** ![SprOS](https://avatars.discourse-cdn.com/v4/letter/s/97f17d/32.png) [@SprOS](https://community.sonarsource.com/u/SprOS)\
**Post date:** [June 2, 2021, 8:15am UTC](https://community.sonarsource.com/t/sonarqube-change-databases-default-passwords/43423/3 "2021-06-02T08:15:23Z")

</div>

Hi @Tobias_Trabelsi, thanks for your reply.

I successfully updated postgres password using psql and updated both `POSTGRES_PASSWORD` and `SONAR_JDBC_PASSWORD`.

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/system/32/31083_2.png) [@system](https://community.sonarsource.com/u/system)\
**Post date:** [June 9, 2021, 8:16am UTC](https://community.sonarsource.com/t/sonarqube-change-databases-default-passwords/43423/4 "2021-06-09T08:16:08Z")

</div>

Closed on June 9, 2021, 8:16am UTC

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.
