1、grafana 默认采用的 sqlite 作为数据源,找到 grafana 的配置文件,到 monitor_servers 的服务器上 ps 一下grafana 进程,可以看到配置文件的路径
[tidb@xiaohou-vm1 ~]$ ps -ef|grep grafana
tidb 88060 1 0 Sep16 ? 00:00:00 bin/supervise status/grafana /data1/deploy_v2.1.16/scripts/run_grafana.sh
tidb 88061 88060 0 Sep16 ? 00:01:31 opt/grafana/bin/grafana-server --homepath=/data1/deploy_v2.1.16/opt/grafana --config=/data1/deploy_v2.1.16/opt/grafana/conf/grafana.ini
tidb 88380 1 0 Sep16 ? 00:00:00 bin/supervise status/grafana_collector /data1/deploy_v2.1.16/scripts/run_grafana_collector.sh
tidb 88381 88380 0 Sep16 ? 00:00:00 bin/grafana_collector --ip=10.0.1.16:3000 --port=:8686 --config=conf/grafana_collector.toml --font-dir=/data1/deploy_v2.1.16/conf/fonts/ --log-file=/data1/deploy_v2.1.16/log/grafana_collector.log --log-level=info
2、cat /data1/deploy_v2.1.16/opt/grafana/conf/grafana.ini
#################################### Database ####################################
[database]
# Either "mysql", "postgres" or "sqlite3", it's your choice
;type = sqlite3
;host = 127.0.0.1:3306
;name = grafana
;user = root
;password =
# For "postgres" only, either "disable", "require" or "verify-full"
;ssl_mode = disable
# For "sqlite3" only, path relative to data_path setting
;path = grafana.db
## 默认的 sqlite 数据文件在 deploy_dir/data.grafana 下面
3、用 sqlite 登录
sqlite3 /data1/deploy_v2.1.16/data.grafana/grafana.db
sqlite> select login, password, salt from user where login = 'admin';
sqlite> update user set password = '59acf18b94d7eb0694c61e60ce44c110c7a683ac6a8f09580d626f90f4a242000746579358d77dd9e570e83fa24faa88a8a6', salt = 'F3FAxVm33R' where login = 'admin';
sqlite> .exit
4、上面的 SQL 可以将默认 Grafana 密码重置为 admin
网友评论