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
- Host: GitHub
- URL: https://github.com/hoaian2/mysql-backup
- Owner: HOAIAN2
- Created: 2024-09-11T23:57:20.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2025-02-23T09:23:48.000Z (over 1 year ago)
- Last Synced: 2025-02-23T10:24:40.630Z (over 1 year ago)
- Topics: backup, database, mysql
- Language: Shell
- Homepage:
- Size: 31.3 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
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)
```