Changing Grafana Database From SQLite to 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 and a New User 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;

Change DB URL in /etc/grafana/grafana.ini

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

Leave a Comment