MySQL backup for -name: all doesn't work but is ok for each database separately #325
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#325
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?
What I'm trying to do and why
Dump Mysql databases as i do for postgreSQL, using -name: all
Steps to reproduce (if a bug)
Produce this error :
But with this config style where i put all databases but each configured :
Produce no error :
Other notes / implementation ideas
The SQL error is the same as if I try to connect in command line without giving password. Is it possible that borgmatic not give the password with "all" ?
Environmentif
borgmatic version: [1.5.6]
borgmatic installation method: [pip3]
borg installation method: [debian stretch]
Borg version: [1.1.9]
Python version: [3.5.3]
Database version (if applicable): [Ver 15.1 Distrib 10.1.44-MariaDB, for debian-linux-gnu (x86_64) using readline 5.2]
operating system and version: [Debian 9.12]
Thank you for filing this one! The main difference between borgmatic's MySQL hook for "all" vs. a single database is that "all" causes borgmatic to run
mysql ... --execute 'show schemas'
in order to list each database to dump. Based on your output, that looks like the command that's failing due toAccess denied
.I've confirmed on my system that the password environment variable is properly passed through to this
show schemas
command. In fact, if I change my "all" configuration to use the wrong password, I getAccess denied
... while it works fine with the right password.So assuming you've got the right password there, then my next guess is that it's a MySQL user-level permissions issue.
Are you able to connect to the database and check out the contents of the
mysql.user
table?Example:
On my machine, I get results something like this:
Not sure why
root
is there twice. But in any case, the user clearly has execute privilige, needed forshow schemas
to work. So does yourroot
user have that permission enabled?Thank you very much for your quick response and the time spent testing and thinking.
It's a backup for a family system, so it's not very important or urgent, but I try to contribute by bringing up the info :-)
SO Yes for me the permissions are there :
(Perhaps your root is there with two different hosts ?)
and if i try
The result is ok
That's super odd! Have you tried the exact command that borgmatic is invoking to see whether that works?
(Substituting
yourpass
of course.)Indeed, after having searched quite a bit before posting my problem here, I only acted like a sheep following your request and without thinking :-)
So I executed the full command and there, ... it doesn't work.
(THe same one with -p, ask password and work)
After some research on the Internet, I came across a Virtualmin thread : https://www.virtualmin.com/node/56959
I usually pass the parameters in /etc/mysql/mariadb.conf.d/... but, and I don't know why, the /root/.my.cnf is completed with a previous password (probably set by the mysql_secure_installation script for mysql ?).
This attribute has precedence over command line environnement variable like MYSQL_PWD, so the password was systematicaly false.
And thus, it's not a bug, it's just a feature and a PEBCAK. I'm Sorry.
Thank you for your time.
No worries! I'm glad you figured it out.. You may be interested in this related ticket, which includes discussions of work-arounds for that same issue: #306