98

what is default username and password for Grafana for http://localhost:3000/login page ? attaching a home page screenshot also.enter image description here I want to watch mySql database for through it.

Samir Talwar
  • 14,220
  • 3
  • 41
  • 65
Jabongg
  • 2,099
  • 2
  • 15
  • 32

12 Answers12

116

By looking up the docs we can find that the magic combo is admin as username and admin as password.

However if you changed some configuration file you should be able to find it there. The default config file can be found here: $WORKING_DIR/conf/defaults.ini and can be overridden using the --config parameter

The item in the config you're looking for should be in the section:

[security]
admin_user = admin
admin_password = admin
Baklap4
  • 3,914
  • 2
  • 29
  • 56
  • 1
    Is this true, that in 2019, they store password in clear text in a file? – Abhijit Sarkar Jul 14 '19 at 06:31
  • @AbhijitSarkar that's the default password, if i'm correct it'll store the password hashed and salted in the database: https://community.grafana.com/t/local-authentication-password-encrypted-or-not/1594 and one may specify a given password – Baklap4 Jul 15 '19 at 12:29
  • from documentation: " if grafana_admin_passwd is not set, the password defaults to prom_operator." https://docs.openstack.org/releasenotes/magnum/stein.html – david Oct 15 '21 at 14:57
  • @david your comment is about a whole another project which uses grafana. They set up their default password to be what you specified which was already given by @Tinkaal in the answer below. The default password for just grafana still remains `admin` to this day. – Baklap4 Oct 18 '21 at 08:28
75

If you are using Prometheus Operator then user/pass is:

user: admin
pass: prom-operator

Install prometheus-operator using helm:

#helm3
helm repo add stable https://kubernetes-charts.storage.googleapis.com

helm install my-prometheus-operator stable/prometheus-operator
Tinkaal Gogoi
  • 4,344
  • 4
  • 27
  • 36
  • I don't get why this answer got >50 upvotes when it relates to a completely different software product. Has the question been edited so we do not see the connection anymore? – MOnsDaR Sep 25 '22 at 18:56
  • @MOnsDaR no it has not been edited except for tags. https://stackoverflow.com/posts/54039604/revisions – GottZ Nov 02 '22 at 21:03
33

I had the same problem. I changed the password after the first login and then forgot what it was. However, I was able to fix it by using the grafana-CLI through the docker container. At the command line:

docker exec -it <name of grafana container> grafana-cli admin reset-admin-password <fill in password>

This resets the admin password back to "admin". When you log in to grafana again, you will be prompted to change the password to something better.

imbatman
  • 508
  • 5
  • 16
RexBarker
  • 1,456
  • 16
  • 14
  • 7
    I had to use `docker exec -ti grafana_container_name grafana-cli admin reset-admin-password new_password` – Fredrik Wendt Jul 15 '19 at 02:01
  • I'm not sure if this answer worked in the past, but for me it didn't work and I had to use the way Fredrik Wendt mentioned. It's also documented: https://grafana.com/docs/administration/cli/ – Kenny Oct 15 '19 at 09:38
  • Also, after reset pod reboot was required in my case – Nigrimmist Mar 04 '21 at 02:46
24

Default credentials for Grafana

username: admin
password: admin
Sreyas
  • 744
  • 1
  • 7
  • 25
15

In K8s, to get user/pass of grafana pod, do the following

Get pods and find out what's the name of grafana pod

kubectl get pod 

Describe grafana pod:

kubectl describe pod my-release-grafana-7f59ddb678-r4jq4

Or simple in one command (if you deployed it in helm chart)

kubectl get pods --namespace default -l "app.kubernetes.io/name=grafana,app.kubernetes.io/instance=my-release"

The output should look like the following:

...
Environment:                                                                                                                                                                                                                         
   GF_SECURITY_ADMIN_USER:      <set to the key 'admin-user' in secret 'my-release-grafana'>      Optional: false                                                                                                                     
   GF_SECURITY_ADMIN_PASSWORD:  <set to the key 'admin-password' in secret 'my-release-grafana'>  Optional: false
    ...

get user name and password from secret:

kubectl get secret my-release-grafana -oyaml 

this should give you something similar to the following output:

apiVersion: v1
data:
  admin-password: T1lsV0ZPY2liM05Ceml5cVZkVmk3N1ZqWWtrS0phU3Jjdm9sMTNkWA==
  admin-user: YWRtaW4=
  ldap-toml: ""
kind: Secret
metadata:
  annotations:
    meta.helm.sh/release-name: my-release
    meta.helm.sh/release-namespace: default
  creationTimestamp: "2021-08-11T20:12:34Z"
  labels:
    app.kubernetes.io/instance: my-release
    app.kubernetes.io/managed-by: Helm
    app.kubernetes.io/name: grafana
    app.kubernetes.io/version: 8.1.0
    helm.sh/chart: grafana-6.15.0
  name: my-release-grafana
  namespace: default
  resourceVersion: "842508"
  uid: 3d3326fb-a7c8-4382-9abc-8ffd2f4d7a11
type: Opaque

decode user name and password

echo "T1lsV0ZPY2liM05Ceml5cVZkVmk3N1ZqWWtrS0phU3Jjdm9sMTNkWA==" | base64 --decode
Muhammad Soliman
  • 21,644
  • 6
  • 109
  • 75
5

default grafana login is

username: admin
password: admin

here is a linux tutorial on how to reset grafana admin password if you lost it https://codesposts.com/Wg04jK59

uberrebu
  • 3,597
  • 9
  • 38
  • 73
4

The easiest thing is reset the password, if you don't have docker installed in your cluster you can use kubectl

kubectl exec -it <name of your pods> -n <name of your namespace> grafana-cli admin reset-admin-password <your reset password>

so it will look like this

kubectl exec -it grafna-haks1k2-628181 -n my-grafana grafana-cli admin reset-admin-password admin

remember: when you don't have a specific namespace in your cluster for Grafana you can remove -n my-grafana.

good luck

newcomers
  • 161
  • 1
  • 12
  • I deployed using the Bitnami Helm chart and mounted a custom grafana.ini, and for some reason the default password it generates wasn't working. Your command did the trick! Got to learn about grafana-cli as well. Thank you! – Abhinav Thakur Dec 31 '21 at 11:42
3
kubectl get secret --namespace $NAMESPACE grafana \
    -o jsonpath="{.data.admin-password}" | base64 --decode ; echo
j3ffyang
  • 1,049
  • 12
  • 12
3

grafana 7.3.5

admin:prom-operator

admin:password

root:admin

root:password

administrator:admin

grafana 9.4

admin:admin

Netwons
  • 1,170
  • 11
  • 14
2

Check your Docker Compose for this:

environment:
  - GF_SECURITY_ADMIN_PASSWORD={{YOUR-PASS-WILL-BE-HERE}}
Bohdlesk
  • 35
  • 1
  • 9
1

Default password for grafana is "admin" for admin user. you can change the same on setting.

LetsNoSQL
  • 1,478
  • 1
  • 11
  • 23
1

With grafana-5.1.4chart the user name is admin and the password is password :)

Son Nguyen
  • 187
  • 1
  • 6