Admin password reset

Hi

I lost my admin password, I tried to reset it as shown in FAQ

sudo grafana-cli --homepath “/usr/share/grafana/” admin reset-admin-password newpass

returns : Incorrect Usage. flag provided but not defined: -homepath

could you help me

thanks

2 Likes

Copy/paste the command you entered and the result please. Hide the password obviously. Put it between lines containing three backticks so the format is not mangled by the forum s/w.

Use the following command, the password will be admin, just run the command and restart the grafana service, hope this helps.

Command: grafana-cli admin reset-admin-password admin

7 Likes

$ sudo grafana-cli admin reset-admin-password admin

Grafana-server Init Failed: Could not find config defaults, make sure homepath command line parameter is set or working directory is homepath

doesn’t work :frowning:

any idea ? :slight_smile: thanks

This might help
https://ahelpme.com/software/grafana/reset-lost-admin-password-of-grafana-server-centos-7/

thanks a lot I tried with sqlite method, it works !!

I use the root user on centos, and i do it on the folder it comes as default, i dont change any directories, and that worked for me 2 times already, but its good that you finally figured it out, sorry for the late response

For everyone that came here by a google search just like I did.
The problem is the order of the command line arguments.

When you use the command like described in the documentation, it failes:

grafana-cli --homepath "c:\Program Files\grafana" admin reset-admin-password mynewpassword
Incorrect Usage. flag provided but not defined: -homepath

But by switching the command line arguments, it works:

grafana-cli admin reset-admin-password --homepath "c:\Program Files\grafana" mynewpassword
t=2019-08-14T11:29:47+0200 lvl=info msg="Connecting to DB" logger=sqlstore dbtype=sqlite3
t=2019-08-14T11:29:47+0200 lvl=info msg="Starting DB migration" logger=migrator

Admin password changed successfully ✔

Grafana Version in use 6.1.3 on Windows 10 Pro (1809).

In WINDOWS 10
Open a console in administrator mode and go to the file folder grafana-cli.exe

cd C:\Program Files\GrafanaLabs\grafana\bin

run this command

grafana-cli admin reset-admin-password mynewpassword

C:\Program Files\GrafanaLabs\grafana\bin>grafana-cli admin reset-admin-password mynewpassword
e[32mINFOe[0m[03-20|00:08:57] Connecting to DB e[32mloggere[0m=sqlstore e[32mdbtypee[0m=sqlite3
e[32mINFOe[0m[03-20|00:08:57] Starting DB migration e[32mloggere[0m=migrator

Admin password changed successfully e[32m✔e[0m

5 Likes

This solved the reset in Ubuntu

Reset admin password

grafana-cli admin reset-admin-password <new password> resets the password for the admin user using the CLI. You might need to do this if you lose the admin password.

grafana-cli admin reset-admin-password <new password>

resets the password for the admin user using the CLI. You might need to do this if you lose the admin password.

Hi,

This worked for me on AIX :

cd /usr/share/grafana

grafana-cli admin reset-admin-password admin

Good Luck

1 Like

Many thanks, this solved the issue!

Can you mark as solution

In Mac with 8.3.5 version.

/usr/local/opt/grafana/bin/grafana-cli --config /usr/local/etc/grafana/grafana.ini --homepath /usr/local/opt/grafana/share/grafana admin reset-admin-password admin

1 Like

Super helpful. Thank you!

hello,
what about doing that on Grafana installed via docker compose?
thanks, a lot

Hello to everyone,
I tried this command (grafana-cli admin reset-admin-password --homepath) but it doesn’t work although I succeeded. I am using Centos 8. Any other ideas?

Please explain in more detail what “it doesn’t work” and “succeeded” mean.

Ideally, please copy and paste here the text of the command you run and the
response you get.

Thanks,

Antony.

1 Like

([root@localhost ~]# grafana-cli admin reset-admin-password ‘admin’ ) I run this command. I get the message ‘admin password changed succussfully’. but I still can’t login.

1 Like