Changing Grafana Database to MySQL

In this article you are going to learn steps for changing Grafana Database To Mysql. We will begin with learning to install Mysql database first. Post Mysql database is installed then we will change Grafana to use Mysql.

Installing MySQL Server

wget https://dev.mysql.com/get/mysql57-community-release-el7-9.noarch.rpm
sudo rpm -ivh mysql57-community-release-el7-9.noarch.rpm
sudo yum install mysql-server

Starting MySQL Server

sudo systemctl start mysqld
sudo systemctl status mysqld
sudo grep 'temporary password' /var/log/mysqld.log

Creating a new database in MySQL Database

sudo mysql_secure_installation
create database grafanadb CREATE USER 'grafana'@'localhost' IDENTIFIED BY 'grafana';
GRANT ALL PRIVILEGES ON grafanadb.* TO 'grafana'@'localhost';
FLUSH PRIVILEGES;

Making changes in Grafana Configuration File.

Open Grafana configuration file which is by default available at /etc/grafana/grafana.ini and change url of mysqldb as shown below:

url =mysql://grafana:grafana@localhost:3306/grafanadb

I hope you liked this article about Changing Grafana Database to MySQL. You can read more about Grafana here or by selecting one of the topics from below list. You can also subscribe me on my Youtube Channel.

Scroll to Top