# How do I set up MySQL from SQLite?

**URL:** <https://community.grafana.com/t/how-do-i-set-up-mysql-from-sqlite/154886>\
**Category:** Grafana\
**Tags:** config-help\
**Created:** [July 21, 2025, 2:21pm UTC](https://community.grafana.com/t/how-do-i-set-up-mysql-from-sqlite/154886 "2025-07-21T14:21:50Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![montanag871](https://avatars.discourse-cdn.com/v4/letter/m/7bcc69/32.png) [@montanag871](https://community.grafana.com/u/montanag871)\
**Post date:** [July 21, 2025, 2:21pm UTC](https://community.grafana.com/t/how-do-i-set-up-mysql-from-sqlite/154886/1 "2025-07-21T14:21:50Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![yosiasz](https://sea2.discourse-cdn.com/grafana/user_avatar/community.grafana.com/yosiasz/32/45847_2.png) [@yosiasz](https://community.grafana.com/u/yosiasz)\
**Post date:** [July 22, 2025, 12:14am UTC](https://community.grafana.com/t/how-do-i-set-up-mysql-from-sqlite/154886/2 "2025-07-22T00:14:21Z")

</div>

welcome to forum @montanag871

how many dashboards do you have? and how many datasources?

Do you have any alerts?

---

<div class="post-metadata">

**Author:** ![infofcc3](https://sea2.discourse-cdn.com/grafana/user_avatar/community.grafana.com/infofcc3/32/51248_2.png) [@infofcc3](https://community.grafana.com/u/infofcc3)\
**Post date:** [July 22, 2025, 11:03am UTC](https://community.grafana.com/t/how-do-i-set-up-mysql-from-sqlite/154886/3 "2025-07-22T11:03:08Z")

</div>

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:

```auto
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`):

```auto
[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

---

<div class="post-metadata">

**Author:** ![montanag871](https://avatars.discourse-cdn.com/v4/letter/m/7bcc69/32.png) [@montanag871](https://community.grafana.com/u/montanag871)\
**Post date:** [July 22, 2025, 4:50pm UTC](https://community.grafana.com/t/how-do-i-set-up-mysql-from-sqlite/154886/4 "2025-07-22T16:50:32Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![yosiasz](https://sea2.discourse-cdn.com/grafana/user_avatar/community.grafana.com/yosiasz/32/45847_2.png) [@yosiasz](https://community.grafana.com/u/yosiasz)\
**Post date:** [July 22, 2025, 6:36pm UTC](https://community.grafana.com/t/how-do-i-set-up-mysql-from-sqlite/154886/5 "2025-07-22T18:36:23Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![montanag871](https://avatars.discourse-cdn.com/v4/letter/m/7bcc69/32.png) [@montanag871](https://community.grafana.com/u/montanag871)\
**Post date:** [July 23, 2025, 6:29pm UTC](https://community.grafana.com/t/how-do-i-set-up-mysql-from-sqlite/154886/6 "2025-07-23T18:29:19Z")

</div>

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.

 ![image](https://us1.discourse-cdn.com/grafana/original/3X/b/d/bdcdda746b87eb9f441909bf407531191616f1dc.png)  
 ![image](https://us1.discourse-cdn.com/grafana/optimized/3X/3/c/3c0bbc85eb83d7388185c7475e5663375d5d17e3_2_690x50.png)

---

<div class="post-metadata">

**Author:** ![yosiasz](https://sea2.discourse-cdn.com/grafana/user_avatar/community.grafana.com/yosiasz/32/45847_2.png) [@yosiasz](https://community.grafana.com/u/yosiasz)\
**Post date:** [July 23, 2025, 7:20pm UTC](https://community.grafana.com/t/how-do-i-set-up-mysql-from-sqlite/154886/7 "2025-07-23T19:20:16Z")

</div>

We have zero insight/context as to how you configured your settings

please share your grafan.ini etc
