From 3c6146fd95835a2d7365b7491ff24ce32ec6d65b Mon Sep 17 00:00:00 2001 From: Jacob Valdez Date: Wed, 11 Jun 2025 09:00:59 -0500 Subject: [PATCH] Docs: Adding clarification for resetting admin password (#106108) * Docs: Adding clarification for resetting adming password with CLI with external DB * adjusting bulleted points * Cutting unneeded wording * adjusting wording to avoid Grafana being possessive * Changing Postgres to PostgreSPQL --- docs/sources/cli.md | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/docs/sources/cli.md b/docs/sources/cli.md index 301741d644a..e5e3ac6f2b5 100644 --- a/docs/sources/cli.md +++ b/docs/sources/cli.md @@ -229,7 +229,7 @@ To correct this, use the `--homepath` global option to specify the Grafana defau grafana cli --homepath "/usr/share/grafana" admin reset-admin-password ``` -If you have not lost the admin password, we recommend that you change the user password either in the User Preferences or in the Server Admin > User tab. +If you have not lost the admin password, we recommend that you change the user password either in the User Preferences or in the **Server Admin > User** tab. If you need to set the password in a script, then you can use the [Grafana User API](../developers/http_api/user/#change-password). @@ -241,6 +241,19 @@ If you installed Grafana using Homebrew, you can reset the admin password using /opt/homebrew/opt/grafana/bin/grafana cli --config /opt/homebrew/etc/grafana/grafana.ini --homepath /opt/homebrew/opt/grafana/share/grafana --configOverrides cfg:default.paths.data=/opt/homebrew/var/lib/grafana admin reset-admin-password ``` +#### Reset admin password for Grafana deployed with Grafana Operator and using an external database + +If you deploy Grafana with Grafana Operator and configure Grafana to use an external PostgreSQL or MySQL database, specify both the homepath and configuration file in your command: + +```bash +grafana cli --homepath /usr/share/grafana --config /etc/grafana/grafana.ini admin reset-admin-password +``` + +If you don't do this, the CLI: + +- Won't see the database connection information since it's in a directory outside of the Grafana homepath +- Will configure the default SQLite database in `/var/lib/grafana` and reset that password instead of for your external database + ### Migrate data and encrypt passwords `data-migration` runs a script that migrates or cleans up data in your database.