How to create the admin role once it has been deleted

Hi all,
Apologies in advance, my knowledge is quite limited.

Installed Grafana on a RPI2, and at first login mechanically created a new user with a new password and deleted the default Admin.

Issue now is the user I created does not have admin authorisation, and I have lost the ability to login as Admin!

  • Tried the following: Purged and uninstalled Grafana: this does not seem to clean the user database so I have the same issue regardless of the version of Grafana installed (only one “basic” user, no admin user).

  • Tried to modify /etc/grafana/grafana.ini to set admin/admin authorisation as default, but it does not seem to create an admin user.

  • Tried to run grafana-cli admin reset-admin-password --homepath “/usr/share/grafana” newpass

But get the following error:

INFO[12-15|12:41:07] Initializing DB logger=sqlstore dbtype=sqlite3
INFO[12-15|12:41:07] Starting DB migration logger=migrator
EROR[12-15|12:41:07] Fail to initialize orm engine logger=sqlstore error=“Sqlstore::Migration failed err: unable to open database file\n”

  • thinking about running the HTTP API command to “boost” my basic user to admin level, but no idea on how to run the script from Linux shell…:

PUT /api/admin/users/2/permissions HTTP/1.1
Accept: application/json
Content-Type: application/json

{“isGrafanaAdmin”: true}

Any help would be greatly appreciated!

Hi,

Please uninstall again and manually delete paths referenced here.

Marcus

This is definitely a Grafana bug, once you created a normal admin user, you could delete the super admin user. It’s easy to get it back, though.

  1. Create a user named admin with email admin@localhost
  2. then reset the password for it

bang! you get the super admin back

My super admin doesn’t come back… :frowning:

Hi Everyone,

We have a production environment in place where the super admin user was deleted, now even by using that recreate admin user tactic it still isn’t a supe admin,. How can we do this without having to go through a re-installation? This is very important.

Thank you,
Br
Diogo

1 Like