Grafana — Database migration from Sqlite3 to MySQL

Maciej
5 min readFeb 24, 2021

Shouldn’t it be Sqlite3?

I don’t say no. It is better to make it only a temporary case where you really want to only test it.

When Grafana goes live and it is heavily used in the team, you want to be sure, however, that in the event of any failure, it will be possible to restore the database quickly and easily.

This time, I will introduce the procedure for migrating from to with sqlite3 to MySQL for Grafana.

Migrating procedure from sqlite3 to MySQL

There are some things that you have to be careful about in order, but it is a method that does not cause data loss, so please proceed with confidence. There are all steps below.

  • Install and configure MySQL
  • Prepare database-migrator for Grafana
  • Extract sql for MySQL from grafana.db
  • Change the settings in grafana.ini
  • Create various MySQL tables
  • Throw data into MySQL

Install and configure MySQL:

I think there are a lot of instructions on the internet for installing MySQL on the ubuntu server. Example tutorial is below:

--

--

Maciej

DevOps Consultant. I’m strongly focused on automation, security, and reliability.