Make "--add-drop-database" optional in MySQL backup #642

Closed
opened 2023-02-19 18:17:32 +00:00 by st1pps · 1 comment

What I'm trying to do and why

I'm backing up my MySQL databases using borgmatic. Borgmatic always includes the "--add-drop-database" parameter when invoking mysqldump. This is problematic for manual restores of individual databases, as this results in all grants for the said database being removed, which can result in extra manual work to restore said grants. As I would always opt for manual restoring of individual database and not use the automatic restore, I'd appreciate it if there was a way to disable the "--add-drop-database" option on the created dumps, if there is nothing speaking against that, so I don't need to remember to edit them manually before restoring.
To retain compatibility with the current version, a property like "disableDropDatabase" could be added to the yaml configuration.

Steps to reproduce (if a bug)

Include (sanitized) borgmatic configuration files if applicable.

Actual behavior (if a bug)

Include (sanitized) --verbosity 2 output if applicable.

Expected behavior (if a bug)

Other notes / implementation ideas

Environment

borgmatic version: 1.7.6

Use sudo borgmatic --version or sudo pip show borgmatic | grep ^Version

borgmatic installation method: user site installation

Borg version: 1.2.0

Use sudo borg --version

Python version: 3.10.6

Use python3 --version

Database version (if applicable): MariaDB 10.3

Use psql --version or mysql --version on client and server.

operating system and version: Ubuntu 22.04

#### What I'm trying to do and why I'm backing up my MySQL databases using borgmatic. Borgmatic always includes the "--add-drop-database" parameter when invoking mysqldump. This is problematic for manual restores of individual databases, as this results in all grants for the said database being removed, which can result in extra manual work to restore said grants. As I would always opt for manual restoring of individual database and not use the automatic restore, I'd appreciate it if there was a way to disable the "--add-drop-database" option on the created dumps, if there is nothing speaking against that, so I don't need to remember to edit them manually before restoring. To retain compatibility with the current version, a property like "disableDropDatabase" could be added to the yaml configuration. #### Steps to reproduce (if a bug) Include (sanitized) borgmatic configuration files if applicable. #### Actual behavior (if a bug) Include (sanitized) `--verbosity 2` output if applicable. #### Expected behavior (if a bug) #### Other notes / implementation ideas #### Environment **borgmatic version:** 1.7.6 Use `sudo borgmatic --version` or `sudo pip show borgmatic | grep ^Version` **borgmatic installation method:** user site installation **Borg version:** 1.2.0 Use `sudo borg --version` **Python version:** 3.10.6 Use `python3 --version` **Database version (if applicable):** MariaDB 10.3 Use `psql --version` or `mysql --version` on client and server. **operating system and version:** Ubuntu 22.04
Owner

Thanks for the suggestion! This is now implemented in master and released in borgmatic 1.7.7 via a new add_drop_database option you can set to false for a given MySQL database to support your use case.

Thanks for the suggestion! This is now implemented in master and released in borgmatic 1.7.7 via a new `add_drop_database` option you can set to `false` for a given MySQL database to support your use case.
Sign in to join this conversation.
No Milestone
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: borgmatic-collective/borgmatic#642
No description provided.