An open API service indexing awesome lists of open source software.

https://github.com/hoaian2/mysql-backup

Bash script to backup mysql /mariadb database in parallel for better performance
https://github.com/hoaian2/mysql-backup

backup database mysql

Last synced: 6 months ago
JSON representation

Bash script to backup mysql /mariadb database in parallel for better performance

Awesome Lists containing this project

README

          

# Mysql-backup

This is a Bash script to backup a MySQL or MariaDB database by exporting data from each table individually and running the backup commands in parallel for optimal speed.

This tool is depend on `mariadb-dump` or `mysqldump` so make sure that you have one of these tools installed on your system.

## Prerequisites

- `mysqldump` or `mariadb-dump`

## Usage

Create `config/backup.conf` file.

```conf
SERVER_TYPE=mariadb
MAX_JOBS=8

DB_HOST="localhost"
DB_USER="your-username"
DB_PASSWORD="your-password"
DB_NAME="your-database"

DUMP_EXTRA_ARGS="--compress --skip-ssl --quick --single-transaction"
```

Run backup with config file

```console
./backup.sh
```

Run restore with default mysql

```console
time mysql --user= --password= demo < <(cat /path/to/your/restore/*.sql)
```