4

I freshly installed Grafana and I cannot login at http://localhost:3000/login

enter image description here

All documentation shows that the default user/password should be admin/admin but I'm locked out.

If I go to check into the file C:\Program Files\GrafanaLabs\grafana\defaults.ini the values are set to:

[security]
# disable creation of admin user on first start of grafana
disable_initial_admin_creation = false

# default admin user, created on startup
admin_user = admin

# default admin password, can be changed before first start of grafana, or in profile settings
admin_password = admin

# used for signing
secret_key = SW2YcwTIb9zpOOhoPsMm

# current key provider used for envelope encryption, default to static value specified by secret_key
encryption_provider = secretKey

If I try to retrieve the password through the e-mail I receive no e-mail.

What am I doing wrong?

Francesco Mantovani
  • 10,216
  • 13
  • 73
  • 113
  • Was Grafana already installed before? – dnnshssm Feb 16 '22 at 10:35
  • @dnnshssm, ho, good question... maybe. I remember I might have installed it last year for a different project. would that be the root cause? – Francesco Mantovani Feb 16 '22 at 13:18
  • thank you @dnnshssm. This sounds like a reply to me, you can post it and I will label it as the answer if it's true. However I don't remember the user/password I used last year and I cannot retrieve it from the retrieve password procedure. Why I don't receive a password in my inbox? – Francesco Mantovani Feb 16 '22 at 14:09

3 Answers3

4

The problem come from the grafana.db file. This is where your password is stored.

In your local machine, install the sqlite3 package

sudo apt-get install sqlite3

Login into your sql database

sudo sqlite3 /var/lib/grafana/grafana.db

Reset the admin password using SQL update (the new password will be admin)

sqlite> update user set password = '59acf18b94d7eb0694c61e60ce44c110c7a683ac6a8f09580d626f90f4a242000746579358d77dd9e570e83fa24faa88a8a6', salt = 'F3FAxVm33R' where login = 'admin';
sqlite> .exit

Now, you could log in your Grafana web interface using username: admin and password: admin

Ritch
  • 41
  • 2
  • This one worked for me. Make sure to use the right login. – P.S.K May 22 '23 at 22:40
  • what is this alphanumeric key you mentioned in query? what is salt? Can i just copy same command? Do i need to edit params? – Ravikrn May 31 '23 at 12:59
  • Error: unable to open database "/var/lib/grafana/grafana.db": unable to open database file getting this error – Ravikrn May 31 '23 at 13:01
  • Ritch, the file path mentioned by Francesco is a Windows path, so this answer is not related to the question strictly. But P.S.K. wrote your answer is helpful... I suggests to improve your question by 1) summarizing general idea and highlighting "for Debians", or 2) adding the Windows case. – Gerard Jaryczewski Jun 05 '23 at 17:10
0

Why is the login with admin:admin despite the configuration not working?

One possibility here is that you had Grafana installed previously (and when using it with the admin account already had to change the default password set in the config). In that case, you did not freshly install Grafana but instead upgraded it. That preserves the database including users and passwords, therefore you will have to use the password you set for that account.

Why are you not getting a reset password email?

I can think of two possibilities here: One is that Email is not configured in the Grafana config file and therefore no emails can be sent. The second one is that you did not set the email address for the account in question (afaik defaults to "admin@localhost") and therefore you don't get any emails. Of course it is possible that both is the case.

How can you solve this?

By either resetting the admin password (that will allow you to keep your existing data) or by removing Grafana and all files completely and making a fresh install.

dnnshssm
  • 1,057
  • 6
  • 17
0

user: admin pass: prom-operator

Try this

Fright89
  • 11
  • 2
  • This does not provide an answer to the question. Once you have sufficient [reputation](https://stackoverflow.com/help/whats-reputation) you will be able to [comment on any post](https://stackoverflow.com/help/privileges/comment); instead, [provide answers that don't require clarification from the asker](https://meta.stackexchange.com/questions/214173/why-do-i-need-50-reputation-to-comment-what-can-i-do-instead). - [From Review](/review/late-answers/34870577) – Ram Chander Aug 23 '23 at 19:48