As it turned out, it is quite easy to break Grafana by changing the name of the organization, or by changing the permissions of the admins. In any case, whatever you broke in your Grafana installation, having access to the server it’s running on, you can fix everything.
Grafana’s status is stored in sqlite3, so, first of all you have to install еhe latest version of the client:
> sudo apt-get install sqlite3
Alternatively you can download binary here. Then login into database:
> sudo sqlite3 /var/lib/grafana/grafana.db
If you need to reset the password, then update admin password hash:
sqlite> update user set password = '59acf18b94d7eb0694c61e60ce44c110c7a683ac6a8f09580d626f90f4a242000746579358d77dd9e570e83fa24faa88a8a6', salt = 'F3FAxVm33R' where login = 'admin';
If you have to reset organization, then:
sqlite> update org set name = 'Main Org.' where id = 1;
If problem is more complicated, and you have backup you always can compare two dumps and figure out what is wrong:
> sqlite3 /var/lib/grafana/grafana.db .dump > new.sql > sqlite3 /backups/grafana/grafana.db .dump > old.sql > diff old.sql new.sql
I hope that helped.