Migrating grafana data to new database

Did you get any errors when importing the database dump? If you did, you may need to manually fix any issues in the SQL so they can import properly. If not, you’ll want to look at the dashboard table and see whether the entries have valid json in the data column.

No errors in importing as well data is valid , and find out one more thing,
Only Dashboards in General Tab/ With out any folder is getting issue , where as Dashboards in any Folder is working as usala, no errors.

Json data from sqlitedb and mysql are same and there is no changes in data …

There’s a bunch of data types that need to be converted if you’re going from sqlite to postgres. I’ve successfully used this tool to migrate a 5.4.3 installation: https://github.com/haron/grafana-migrator

Did you get it working?

Can I use AWS RDS mysql as a database for grafana? If so, can you please let me know how can I restore grafana.db sqlite3 to mysql? I was able to convert the sqlite db to mysql and configured grafana to use mysql, but I am seeing empty dashboards. Can you please help?

@thachnv92 How did you resolve ERROR 1146 (42S02) at line 1: Table ‘grafana.alert’ doesn’t exist?

Thx for this solution, helped me to migrate to maridb in minutes!! GREAT

I am having the same problem as “raja4frnz” where after the data transfer to mysql dashboards do not show a title, or any panels. (with the exception of 1 dashboard) The dashboard titles do show in the dashboard list.
I am using:
Grafana v6.4.3 (commit: 3a2bfb7)
MariaDB Server: 5.5.64
CentOS Linux release 7.5.1804
Procedure used: Shut down Grafana, saved grafana.db, ran the new version of dcech’s script to get sqls, changed grafana.ini to point to mysql db, brought up grafana, waited 3 minutes and shutdown grafana, imported sql data into mysql db, started grafana.
On the manage dashboard page I can see all the dashboard titles but when selecting them only 1 works. I have confirmed that the data field of the dashboard table contains JSON data for all 3 dashboards.
In examining the sql data exported from the sqlite3 db I see that the one dashboard that works was saved in hexidecimal format and not json as the other 2 were.
I am testing this migration in a lab setup before touching production.
Any help will be appreciated.

So sorry, Long time I don’t login to this community.
I don’t remember it @@

worked like a charm!

This script has now been slightly modified (to handle some little issues I ran into recently with a migration from sqlite to MySQL), and has been posted to a public GitHub repo here:

By putting this script in a repo, we can more easily keep it up to date, track changes, publish an associated README, etc.

Enjoy!
Eric

Hi
I get the below error when I try to import the database:
ERROR 1062 (23000) at line 201808: Duplicate entry '281536' for key 'annotation.PRIMARY'

Hi,

When I import to database I get this error

ERROR 1146 (42S02) at line 1: Table ‘grafana_serverdb3.alert’ doesn’t exist

Is there a particular version of MySQL recommended to use, or versions which have been tested?