Grafana Installation with MySQL Database

In this article we will install and configure Grafana with MySQL database. Grafana is an open source monitoring and data visualization tool. Grafana use MySQL for storing Users, sessions and dashboard ( You can use other databases as well).  Let’s start with Grafana installation.

Lab setup

OS:  Amazon linux.

Grafana version: 6.3.2

Hosted on : AWS

Database: MySQL

Grafana Installation

Download the rpm package from the official Grafana website. Below link helps you to get it.

Execute below command to install the Grafana package.

[root@techiescorner ~]# wget

[root@techiescorner ~]# yum localinstall grafana-6.3.2-1.x86_64.rpm

Once the installation completed we can start the service with following command.

[root@techiescorner ~]# service grafana-server start

Check server status with below command.

The default port of Grafana is 3000, make sure that you have opened it in firewall.

Database Configuration

Login to the MySQL and execute below commands to create a user and password and grant access for the user over the database.

mysql> create database grafana;

Query OK, 1 row affected (0.01 sec)

mysql> grant all privileges on grafana.* to grafana@localhost identified by "Techies123";

Query OK, 0 rows affected, 1 warning (0.01 sec)

mysql> flush privileges;

Query OK, 0 rows affected (0.01 sec)

mysql> exit

Add database  details in the Grafana configuration file. The location will be

/etc/grafana/grafana.ini  Please refer below screenshot.

Restart Grafana service to pickup the newly added database details.

[root@techiescorner ~]# service grafana-server restart

Stopping Grafana Server: ...                               [  OK  ]

Starting Grafana Server: ...                               [  OK  ]

Now try to access Grafana interface from the browser, http://< your server IP>:3000. The default Username and Password is “admin”.

Once you logged in first time you need to change the password.

From the Grafana home page click on “Add database” option to adde database details. Refer below screen shot


By clicking “Save&Test” button you can confirm the details are correct. If you are getting any error, please make sure you have used correct the database name, user and password. Also, make sure that the user has access to the associated database.


Leave a Reply

Your email address will not be published. Required fields are marked *