Grafana MySQL -> PostgreSQL migration

Hello there!

For operational reasons we would like to move our Grafana installation from a MySQL database to a PostgreSQL database.

Does anybody know what’s the best way to approach this task?

I was wondering if theres some kind of automated way to export the current settings as a whole (configuration, organization, groups, users, dashboards, datasources etc) in order to re-import them later into another grafana instance (this would help me a lot of course)


  • What Grafana version and what operating system are you using?

I’m currently running grafana v7.4.5 (8a2c78d3f8) running as a docker container in a Kubernetes cluster.

  • What are you trying to achieve?

Migrate from MySQL to PostgreSQL while keeping as much data as possible.


Thank you in advance,

Znpy

Just checking @znpy

You are aware that Grafana’s default db is SQLite, yes? So this is an installation where you’ve already migrated from SQLite to MySQL?

Hi @mattbrams and thank you for your reply!

This installation was configured to use MySQL from the beginning. I authored the config.ini myself at the time, configuring MySQL from the beginning.

Does this help in any way?

Thank you!

1 Like

Nothing ?

@mattabrams at this point a negative reply would be fine too, at least I know I have start thinking about setting up a new grafana instance and perform a migration to it :sweat_smile:

Thank you anyway for your help though! :slight_smile:

sorry I can’t be more helpful, @znpy

if you do attempt a migration, let us know about the experience. Maybe we can add a helper script like this one for migrating from SQLite to MySQL:

Big pain point for many people migration. But seems not a grafana issue?

you could extract from mysql as csv and try to restore it that way?

facing the same requirement, mysql to pg. not sure who has a successful experience.

Why are you migrwting from mysql to pg.

Also its really an issue outside of grafana?