Grafana将数据库由sqlite3改为mysql

Grafana数据默认是存放在sqlite3,可以通过修改配置文件将数据库改为mysql。

Grafana版本5.1.3,mysql版本5.6.40
参考:http://docs.grafana.org/v5.1/installation/configuration/
https://blog.csdn.net/kk185800961/article/details/80030123

创建数据库
CREATE DATABASE IF NOT EXISTS grafana DEFAULT CHARSET utf8 COLLATE utf8_general_ci;
创建用户
create user grafana@'%' IDENTIFIED by 'grafana';
授权
grant all privileges on grafana.* to grafana@localhost identified by 'grafana';
刷新权限表
flush privileges; 

停止grafana服务

systemctl stop grafana-server.service

修改grafana配置文件,grafana配置文件位于/etc/grafana/grafana.ini

[database]
type = mysql
host = 127.0.0.1:3306
name = grafana
user = grafana
password =grafana
url = mysql://grafana:grafana@localhost:3306/grafana

[session]
provider = mysql
provider_config = `grafana:grafana@tcp(127.0.0.1:3306)/grafana`

重启grafana服务

systemctl start grafana-server.service
已标记关键词 清除标记
相关推荐
©️2020 CSDN 皮肤主题: 代码科技 设计师:Amelia_0503 返回首页