How to reset Grafana admin password
A short guide on resetting the admin password of Grafana that is running as a pod in Kubernetes.
If you ever get into a situation where you have forgotten Grafana admin password & need to reset it, simply follow the below steps. These steps assume that your Grafana instance is running inside Kubernetes as a pod. However, these steps mostly remain the same for Grafana installations that are running on any platform.
Steps to follow.
1. Get the Grafana pod name.
kubectl get po -n monitoring | grep grafana
NAME READY STATUS RESTARTS AGE
grafana-deployment-bb48556d6-7ddpr 1/1 Running 0 44h
2. Login to the pod.
shashank@Shashanks-MacBook-Pro ~/C/v/deployments> kubectl exec -it grafana-deployment-bb48556d6-7ddpr -n monitoring -- bash
Defaulted container "grafana" out of: grafana, fix-permissions (init)
3. Enter the below command
grafana-cli admin reset-admin-password <new_password>
Replace <new_password> with the password you want to change to.
grafana-deployment-bb48556d6-7ddpr:/usr/share/grafana$ grafana-cli admin reset-admin-password <new_password>
INFO [06-07|07:41:03] Starting Grafana logger=settings version= commit= branch= compiled=1970-01-01T00:00:00Z
WARN [06-07|07:41:03] "sentry" frontend logging provider is deprecated and will be removed in the next major version. Use "grafana" provider instead. logger=settings
INFO [06-07|07:41:03] Config loaded from logger=settings file=/usr/share/grafana/conf/defaults.ini
INFO [06-07|07:41:03] Config overridden from Environment variable logger=settings var="GF_PATHS_DATA=/var/lib/grafana"
INFO [06-07|07:41:03] Config overridden from Environment variable logger=settings var="GF_PATHS_LOGS=/var/log/grafana"
INFO [06-07|07:41:03] Config overridden from Environment variable logger=settings var="GF_PATHS_PLUGINS=/var/lib/grafana/plugins"
INFO [06-07|07:41:03] Config overridden from Environment variable logger=settings var="GF_PATHS_PROVISIONING=/etc/grafana/provisioning"
INFO [06-07|07:41:03] Target logger=settings target=[all]
INFO [06-07|07:41:03] Path Home logger=settings path=/usr/share/grafana
INFO [06-07|07:41:03] Path Data logger=settings path=/var/lib/grafana
INFO [06-07|07:41:03] Path Logs logger=settings path=/var/log/grafana
INFO [06-07|07:41:03] Path Plugins logger=settings path=/var/lib/grafana/plugins
INFO [06-07|07:41:03] Path Provisioning logger=settings path=/etc/grafana/provisioning
INFO [06-07|07:41:03] App mode production logger=settings
INFO [06-07|07:41:03] Connecting to DB logger=sqlstore dbtype=sqlite3
INFO [06-07|07:41:03] Starting DB migrations logger=migrator
INFO [06-07|07:41:03] migrations completed logger=migrator performed=0 skipped=484 duration=711.937µs
INFO [06-07|07:41:03] Envelope encryption state logger=secrets enabled=true current provider=secretKey.v1
Admin password changed successfully ✔
And that’s it. Now try logging into Grafana using the new password. I hope you found this article helpful.