Forgot Grafana password, how to reset to default password admin

Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.

Original topic: grafana密码忘了,如何恢复默认密码admin

| username: TIDB-Learner

Here is my solution. If there are other methods, please advise.

  1. Check the Grafana deployment path.
  2. Switch to the data directory.
    cd /data/tidb-deploy/grafana-3000/
  3. Modify the command:
    Enter the database
    sqlite3 grafana.db
    Change the password
    update user set password = ‘59acf18b94d7eb0694c61e60ce44c110c7a683ac6a8f09580d626f90f4a242000746579358d77dd9e570e83fa24faa88a8a6’, salt = ‘F3FAxVm33R’ where login = ‘admin’;
    Exit
    .exit
| username: changpeng75 | Original post link

If the prompt “Admin password changed successfully :heavy_check_mark:” appears, it means it is already okay.

| username: yiduoyunQ | Original post link

To restore Grafana’s default password admin, you can follow these steps:

Method 1: Reset User Password

  1. Stop Grafana Service:
  • For Linux systems, use the following command to stop the Grafana service:
sudo systemctl stop grafana-server
  • For Windows systems, open the Service Manager, find the Grafana service, and stop it.
  1. Edit Grafana Database:
  • Locate Grafana’s SQLite database file, usually found at /var/lib/grafana/grafana.db.
  • Use the SQLite3 tool to open the database file:
sqlite3 /var/lib/grafana/grafana.db
  • Run the following SQL command to reset the password:
UPDATE user SET password = '5f4dcc3b5aa765d61d8327deb882cf99' WHERE login = 'admin';
  • 5f4dcc3b5aa765d61d8327deb882cf99 is the MD5 hash value for admin.
  1. Restart Grafana Service:
  • For Linux systems, use the following command to restart the Grafana service:
sudo systemctl start grafana-server
  • For Windows systems, open the Service Manager, find the Grafana service, and start it.
  1. Log in to Grafana:
  • Open your browser and go to the Grafana login page.
  • Log in with the default username admin and password admin.
  • The system will prompt you to change the password; follow the instructions.

Method 2: Modify Configuration File

  1. Edit Grafana Configuration File:
  • Locate and edit the Grafana configuration file /etc/grafana/grafana.ini.
  • Add or modify the following content under the [security] section:
[security]
admin_user = admin
admin_password = admin
  1. Restart Grafana Service:
  • For Linux systems, use the following command to restart the Grafana service:
sudo systemctl restart grafana-server
  • For Windows systems, open the Service Manager, find the Grafana service, and restart it.
  1. Log in to Grafana:
  • Open your browser and go to the Grafana login page.
  • Log in with the default username admin and password admin.
  • The system will prompt you to change the password; follow the instructions.

Both methods can help you restore Grafana’s default password. If you have any questions or need further assistance, please let me know.

| username: zhaokede | Original post link

Got it.

| username: TiDBer_QYr0vohO | Original post link

Execute grafana-cli admin reset-admin-password <new password> and then restart Grafana.

| username: 小龙虾爱大龙虾 | Original post link

Scale down and then scale up again, anyway, there’s no data in Grafana.

| username: 呢莫不爱吃鱼 | Original post link

I encountered this problem before and it was quite tricky. We were even ready to scale down, but other colleagues had saved the password, so we didn’t go that route. It turns out you can reset it through a command. Marking this down~! grafana-cli admin reset-admin-password

| username: FutureDB | Original post link

You can try resetting the password. I have tried it before, and the operation is quite simple.
grafana reset password

| username: 健康的腰间盘 | Original post link

Saved, excellent post.

| username: hacker_77powerful | Original post link

What should I do if there is a vulnerability in Grafana?

| username: TIDB-Learner | Original post link

If it reaches that point, it means physical security can’t be guaranteed, so there’s no need to worry about any data leaks. :joy:

| username: TIDB-Learner | Original post link

Just take it away.

| username: 帅的掉渣 | Original post link

Learned :innocent: