How to backup a MariaDB or MySQL database using MySQLDump

After my video last week on what I am self hosting:

I had a few people ask about my database backup script. I am going to do an upcoming video on it, but because I need to add the code somewhere, so I made a write up on www.spacerex.co! Write up here:

Let me know what you think & if this still needs a video!

Hi Will,

Presumably you use Mariaa.db as a general database for many applications.

Could you give:

  • a run down of how you do this

  • what applications you are targeting to the DB

  • how you configure the applications to use the DB

Using a single DB definitely interests me - just not sure how to do it.

Also - where do you host the DB? Synology?

Do you have any pointers to tutorials?

Cheers

Steve

also interested in this topic - I’m just starting into the NAS world having received my DS923+ a couple of days ago.

I definitely want to use a single db for all the applications that I’m considering running with docker, so definitely a tutorial around this would be greatly appreciated * winking at @Will * :smiley:

Same as you @Steve and @h3li0, also interested in this topic after I saw your video and saw database was the first topic you mentioned.

I think a full video on this topic would be very useful for a lot of us :pray:

Maybe you guys find any info on this topic since then?

Some updates on what Will has posted.

Step 1 - Creating the Backup User

CREATE USER ‘backupuser’@‘localhost’ IDENTIFIED BY ‘password’;

GRANT LOCK TABLES, SELECT, SHOW VIEW, PROCESS ON . TO ‘backupuser’@‘localhost’;

FLUSH PRIVILEGES;

EXIT;

There are 2 ways to backup MariaDB:

    1. Using mariadb-dump & mysqldump – The mariadb-dump utility is the newer name for mysqldump, though you can still run it using either name.
    1. Using mariadb-backup

This guide uses MySQLDump - Making Backups with mariadb-dump

Here are some other links on MariaDB backup using different methods:

Cheers

1 Like

Sorry for grave digging, but i use this

It works perfectly fine on DSM