Whats the Best way to Backup the HA Database on MariaDB 10?

Hi I’m using MariaDB 10 to host my HA database on a dedicated machine and it works great, no SD card issues on my Pi now I’m using MariaDB.

The only problem I have now is that I’m unable to easily backup my database file.

Before I could just archive my home-assistant_v2.db file that was it. In fact I could even automate daily backups using nodered or the command line switch. However using MariaDB I can’t seem the find the DB file anywhere.

I know a few other people on here are using MariaDB, it’s mySQL essentially, what are the best ways of backing up your DB? Thanks :slight_smile:

Have a look in /var/lib/mysql or /var/lib/mariadb, however you don’t back it up by copying a file as you do with sqllite, you dump the database.

Here are some methods…

Personally I don’t both. I fact, I’ve deleted it a couple of times as I’ve moved things around as, for me, it’s not essential data. Just history of states I think.

That would explain why I couldn’t find a single DB file, it looks like it’s multiple files over multple folders on my system.

THere are quite a few options in that link, for now I’ve tried the mysqldump command and it seems to work, plus I should be able to automate it so that it backs up every night if I like.

All my configs are on bitbucket and I have wiped or lost the database before but I’d like to keep history states if I can, as I’m now using grafana to pull data out of the database