Skip to content

Instantly share code, notes, and snippets.

View PattaFeuFeu's full-sized avatar
🏡
Working from home

Patrick Geselbracht PattaFeuFeu

🏡
Working from home
View GitHub Profile
@PattaFeuFeu
PattaFeuFeu / HA_Migrate-sqlite-to-mysql.md
Last active September 8, 2024 06:41
Steps necessary to migrate from HomeAssistant’s standard sqlite database to an external MariaDB(10) SQL database

Migrate Home Assistant’s sqlite database to MySQL, specifically MariaDB (10)

After having added a decent amount of entities to my Home Assistant setup, the user interface—especially the history tab, but also the history for each entity—became very sluggish. Having to wait for up to 30 seconds to see the history graph for a single entity became the norm with an sqlite file weighing in at 6GB and millions of entries in the “events” and “states” tables.

I wanted to keep my acquired data, so I had to migrate it from the current sqlite file to a MySQL database instead of starting anew. I’ve done this using Home Assistant version 0.81 and MariaDB 10. Some parts might change in the future.

Dump Home Assistant sqlite database