How to access the Sonarqube database to reset admin password

Must-share information (formatted with Markdown):

  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)
    sonarqube 9.9.1 and sonar scanner 4.4.0.2170
    We are running on RHEL 8
  • how is SonarQube deployed: zip, Docker, Helm
    ZIP fie / java jar file.
  • what are you trying to achieve
    We are trying to access the database to reset the admin password
  • what have you tried so far to achieve this
    We have read the “Reinstating admin access” doc here. Security
    We do not know how to access the database.

Here are my sonar.properties entries for the DB
sonar.jdbc.url=jdbc:postgresql://localhost/sonardb

That being said, postgresql is not running and so I am obviously missing something.
I can provide any needed information, however I am not a sonarqube user and so I am not sure what to provide. I am trying to help my team get some answers. Any help is appreciated.

Do not share screenshots of logs – share the text itself (bonus points for being well-formatted)!

Hi,

Welcome to the community!

If Postgres isn’t running, then you’ve likely fallen back to the H2 database, which is embedded for evaluation purposes only, and is not supported for production use.

You can verify this by checking the bottom of the page in SonarQube, where you’ll likely see a warning banner.

So… basically your current data is toast, since there’s no migration from H2.

Your next steps

  • get Postgres running - ideally on a different host, so that SonarQube and Postgres aren’t contending for resources
  • get SonarQube connected to Postgres (your server logs are your friends in this area, particularly web.log).

 
Ann

Ann, thank you for the prompt reply. So this was ignorance on my part. The postgresql systemd file was not updated to use the correct path for PGDATA. I corrected that and it actually fixed the issue. Thank you for your attention.

Jimmy

1 Like