I know there is a lot of information on how to migrate from SQLite to MySQL, but I can’t seem to find anything that tells me how to make the MySQL database itself. So I ask you, the community of Grafana, how would I go about making the MySQL database?
welcome to forum @montanag871
how many dashboards do you have? and how many datasources?
Do you have any alerts?
You can try this solution for fix your Issue
Step: 1 Install and Setup MySQL
a. Login to mysql
mysql -u root -p
b. Create Database
CREATE DATABASE grafana_db CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
c. Create a user and grant permissions:
CREATE USER 'grafana_user'@'localhost' IDENTIFIED BY 'your_strong_password';
GRANT ALL PRIVILEGES ON grafana_db.* TO 'grafana_user'@'localhost';
FLUSH PRIVILEGES;
Step 2 Create Table with Same filed that axist in Sql lite
Step 3 Export SQLite Schema and Data
sqlite3 grafana.db .dump > sqlite_dump.sql
Step : 4 Replace AUTOINCREMENT with AUTO_INCREMENT
Remove PRAGMA lines
Change INTEGER PRIMARY KEY to INT PRIMARY KEY AUTO_INCREMENT
Remove BEGIN TRANSACTION; / COMMIT;
Step : 5 Import the Cleaned SQL File into MySQL
mysql -u grafana_user -p grafana_db < cleaned_mysql_dump.sql
Step : 6 If require Point Grafana to MySQL
Edit grafana.ini (usually in /etc/grafana/grafana.ini):
[database]
type = mysql
host = 127.0.0.1:3306
name = grafana_db
user = grafana_user
password = your_strong_password
i hope this solution will be helpful for you
It is a new install that is in proxmox, I have a backup that I have used to place it back to right before making the admin account. I have a way to get data onto it if necessary, though.
Aka:
Dashboards: 0
Datasources: 0
Alerts: 0
if a brand new install with nothing in it, just follow the section @infofcc3 posted but only Step 1 => b & c section and the grafana.ini section.
Then stop grafana
Then restart grafana and it will auto scaffold all of the tables for you.
After trying ~ 3 times, I haven’t been able to get the server to successfully recognize that it should be going to MySQL I am unsure what I should do at this point. With that it also keeps saying in the settings of the web interface that I should restart the server to apply the changes, even after doing so.
We have zero insight/context as to how you configured your settings
please share your grafan.ini etc
