mirror of
https://github.com/jkaninda/mysql-bkup.git
synced 2025-12-06 13:39:41 +01:00
doc: reviewed docs
This commit is contained in:
@@ -5,36 +5,60 @@ parent: How Tos
|
||||
nav_order: 5
|
||||
---
|
||||
|
||||
# Restore database
|
||||
|
||||
To restore the database, you need to add `restore` command and specify the file to restore by adding `--file store_20231219_022941.sql.gz`.
|
||||
# Restore Database
|
||||
|
||||
{: .note }
|
||||
It supports __.sql__,__.sql.gpg__ and __.sql.gz__,__.sql.gz.gpg__ compressed file.
|
||||
To restore a MySQL database, use the `restore` command and specify the backup file to restore with the `--file` flag.
|
||||
|
||||
### Restore
|
||||
The system supports the following file formats:
|
||||
|
||||
```yml
|
||||
- `.sql` (uncompressed SQL dump)
|
||||
- `.sql.gz` (gzip-compressed SQL dump)
|
||||
- `.sql.gpg` (GPG-encrypted SQL dump)
|
||||
- `.sql.gz.gpg` (GPG-encrypted and gzip-compressed SQL dump)
|
||||
|
||||
---
|
||||
|
||||
## Configuration Steps
|
||||
|
||||
1. **Specify the Backup File**: Use the `--file` flag to specify the backup file to restore.
|
||||
2. **Provide Database Credentials**: Ensure the correct database connection details are provided.
|
||||
|
||||
---
|
||||
|
||||
## Example: Restore Configuration
|
||||
|
||||
Below is an example `docker-compose.yml` configuration for restoring a database:
|
||||
|
||||
```yaml
|
||||
services:
|
||||
mysql-bkup:
|
||||
# In production, it is advised to lock your image tag to a proper
|
||||
# release version instead of using `latest`.
|
||||
# Check https://github.com/jkaninda/mysql-bkup/releases
|
||||
# for a list of available releases.
|
||||
# In production, lock your image tag to a specific release version
|
||||
# instead of using `latest`. Check https://github.com/jkaninda/mysql-bkup/releases
|
||||
# for available releases.
|
||||
image: jkaninda/mysql-bkup
|
||||
container_name: mysql-bkup
|
||||
command: restore -d database -f store_20231219_022941.sql.gz
|
||||
volumes:
|
||||
- ./backup:/backup
|
||||
- ./backup:/backup # Mount the directory containing the backup file
|
||||
environment:
|
||||
- DB_PORT=3306
|
||||
- DB_HOST=mysql
|
||||
- DB_HOST=postgres
|
||||
- DB_NAME=database
|
||||
- DB_USERNAME=username
|
||||
- DB_PASSWORD=password
|
||||
# mysql-bkup container must be connected to the same network with your database
|
||||
# Ensure the pg-bkup container is connected to the same network as your database
|
||||
networks:
|
||||
- web
|
||||
|
||||
networks:
|
||||
web:
|
||||
```
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Key Notes
|
||||
|
||||
- **Supported File Formats**: The restore process supports `.sql`, `.sql.gz`, `.sql.gpg`, and `.sql.gz.gpg` files.
|
||||
- **Encrypted Backups**: If the backup is encrypted with GPG, ensure the `GPG_PASSPHRASE` environment variable is set for automatic decryption.
|
||||
- **Network Configuration**: Ensure the `mysql-bkup` container is connected to the same network as your database.
|
||||
|
||||
Reference in New Issue
Block a user