Pass additional options to MySQL database list command #306
Labels
No Label
bug
data loss
design finalized
good first issue
new feature area
question / support
security
waiting for response
No Milestone
No Assignees
2 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: borgmatic-collective/borgmatic#306
Loading…
Reference in New Issue
No description provided.
Delete Branch "%!s(<nil>)"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Context
Hello, I'm trying to setup mysql dumps using a restricted backups user.
I manage to connect from cli equivalent :
But still the dump fails :
Something I do not understand either, I tried to remove /root/.my.cnf which contains :
and then the dump would work. But why ? I dont understand.
How it should work
The mysqldump from borgmatic scheduled cron should work as expected, with /root/.my.cnf existing or not.
Environment
borgmatic version: 1.5.2
borgmatic installation method: PIP3
Borg version: 1.1.9-2
Python version: 3.7.3
Database version (if applicable): 10.3.22-MariaDB
operating system and version: Debian 10 x86
Borgmatic conf:
The user backups can connect from
localhost
or127.0.0.1
only, and have following privileges:*.*:LOCK TABLES,SELECT,SHOW VIEW
Cron command:
Thank you for including the detailed information in the ticket. I'm a little perplexed about the behavior you're seeing though. It sounds like borgmatic works when
~/.my.cnf
is not there, and it fails due to permissions when~/.my.cnf
is present. My first reaction would be that the~/.my.cnf
is causing it to try to connect as root with invalid credentials. But that does not appear to be the case, because your logs sayAccess denied for user 'backups'@'localhost'
, not for the root database user. Are you sure that log entry corresponds to borgmatic's connection attempt? There's nothing in there about a connection from root?I'm not sure this is possible given how borgmatic interacts with MySQL. Specifically, it invokes the
mysql
binary, which as far as I know, doesn't have a way to disable the~/.my.cnf
configuration file. I agree though that it's confusing to have that outside influence.Hello @witten, thanks for your time.
I just made two tests to make my says valid :
I then tried to uncomment the password entry in
.my.cnf
and it indeed succeed. I now remember having the almost same issue with my old backup system using Backupmanager. But it was then usingmysqldump
utility and a.backup-manager_my.cnf
file containing :And it was using in its command line
--defaults-extra-file=filename
And now i'm wondering if I could not try the same thing for borgmatic with one of thoses :
but i'm not sure it would succeed as it is using the mysql utility, same utility described in my
.my.cnf
After 5 min of thoughts it will not be possible as the
options
ofmysql_databases
in borgmatic is used only for the mysql dump command line, andis not using the
options
ofmysql_databases
contained in borgmatic config.yamlHello,
I managed to bypass this issue with
but that's... pretty ugly.
Any more thoughts on that?
Sorry for the delay here. A couple of different ideas:
list_options
configuration option to support passing additional options to themysql
command used for listing databases. That would allow you to manually specify--defaults-file=whatever
for bothoptions
andlist_options
.defaults_file
option to the configuration, so you can just set a value other than.my.cnf
, and borgmatic will take care of passing it to bothmysql
andmysqldump
.Have you confirmed that manually passing
--defaults-file=...
tomysql
ormysqldump
gets the desired behavior on your system?Hello @wittens, sorry for the delay as well. Here is the result :
I think that :
Would be indeed a great option. It would allow to list ANY additional parameters :))
Sounds good. I'll rename this ticket accordingly!
Required permissions for mysql dump ?to Pass additional options to MySQL database list commandJust released in borgmatic 1.5.21!
Very nice ! :D