Difficulty with sqlite to mysql migration


I’m using Grafana 10.0 on a Centos7 server, I migrated from Grafana 6 to Grafana 10, and some problems related to panels, alerts, dashboards were found but I could solve them.

But now I have this “database is locked” behaviour of sqlite3, and I want to migrate the data (I already have more than 400 panels and alert rules) to a MySQL

For this I tried running this script: https://github.com/grafana/database-migrator but it couldn’t export any data, as is shown below:

So I verified that the version of the sqlite of this centos version is not “supported” by this script above. So I tried the same process in a Ubuntu 22.04 with newer sqlite and it shows another error:

Then I tried my luck with this script posted by @dcech

This time the data was exported to the .sql file succesfully, then I imported in grafana’s new mysql database (with the grafana tables created). Users, dashboards and datasources were imported, but alerts, notification rules and contacts weren’t shown in grafana’s ui.

So I accessed the database with dbeaver, and actually it looks like all the data related to alerts IS stored in the base, but grafana’s ui is somehow unable to access them. Checking grafana.log, it shows this error:

And this message in the UI

So, now our problem is specifically with the Alert section OR if someone maybe have a better migration script, or some tips in this situation I appreciate it.

Is it me or is there a lot of database locked errors happening?

Depends what you are doing

I always encourage people to migrate one full version at a time
6 to 7
7 to 8
8 to 9
9 to 10

So not only are you making a huge version upgrade but also now migrating to mysql

The patient needs time to heal

Yes but the migration was smoother than I expected, as I said I got some problems, but they were solved, the very last problem is this sqlite thing

I gonna test performing this database migration in Grafana 6, as I have a snapshot of the pre migration state, maybe I’ll be luckier…

1 Like