DEV Community

Cover image for mariabak: Making MariaDB and MySQL backups a breeze
Lawrence Lagerlof
Lawrence Lagerlof

Posted on • Edited on

3 1

mariabak: Making MariaDB and MySQL backups a breeze

About

mariabak is a opensource command-line program frontend for mysqldump to make MariaDB and MySQL databases backups. Some operations are easier using mariabak than using mysqldump directly.

Project page

https://github.com/llagerlof/mariabak

Let's see some of the goodies:

  • You can opt-out dump data from specific tables. The good news: the tables structure will be preserved (mysqldump doesn't have this as a native option so you need to execute more than one command to do this).

  • You can perform backup of all databases at once, or just some chosen databases, creating one dump file for each database (mysqldump put all databases into one single dump file).

  • One directory with a timestamp will be created for each mariabak execution (more than one file is generated for each backup, so let's keep things organized).

  • It backups all the user grants, system variables and events to separate files.

Hands-on

Demonstration

Usage examples

List databases:

$ mariabak -list     # default localhost, user root, empty password
Enter fullscreen mode Exit fullscreen mode

Backup all databases. A directory will be created in current directory:

$ mariabak --databases=*
Enter fullscreen mode Exit fullscreen mode

Backup one database, asking for the server password interactively:

$ mariabak --databases=db1 --host=localhost --user=root -p
Enter fullscreen mode Exit fullscreen mode

Backup some databases, ignore some tables data but preserve its structure:

$ mariabak --databases=db1,db2,db3 --ignore-tables=db2.table1,db2.table2,db3.table_a --user=root -p
Enter fullscreen mode Exit fullscreen mode

Backup one database, passing the server password inline:

$ mariabak --databases=db1 --host=localhost --user=root --port=3306 --password=hunter2  # Caution with this one. The shell can save command history.
Enter fullscreen mode Exit fullscreen mode

Sentry image

See why 4M developers consider Sentry, “not bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay