This is the LATEST version of a small script I’ve used successfully to dump data from a grafana sqlite db in a format that works with mysql for migrating instances from sqlite to mysql:
#!/bin/bash
DB=$1
TABLES=$(sqlite3 $DB .tables | sed -r 's/(\S+)\s+(\S)/\1\n\2/g' | grep -v migration_log)
for t in $TABLES; do
echo "TRUNCATE TABLE $t;"
done
for t in $TABLES; do
echo -e ".mode insert $t\nselect * from $t;"
done | sqlite3 $DB
Use it like sqlitedump.sh grafana.db > grafana.sql
to create the script to insert data into the MySQL database.
Start Grafana and let it set up the db structure in MySQL, then you can run the sql to populate the content (be warned it truncates the tables first, so any existing data in mysql will be lost)
mysql grafana < grafana.sql