mariadb backup fails with unexpected access denied #1205
Labels
No labels
blocked
breaking
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#1205
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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
I run borgmatic in docker, and use the mariadb backup feature like this:
My .env has these variables, and they work. The start of the backup is doing fine, I see in the logs the dumps of the databases being made.
However, at the end, I suddenly see this:
mariadb-dump: Got error: 1045: "Access denied for user 'root'@'borgmatic.backups' (using password: YES)" when trying to connect
I dont use the
borgmatic.backupsmariadb host anywhere.Steps to reproduce
Database config part of my .env:
Actual behavior
At the and, after the stats of the repo:
Edit: It seems to happen when running for the second repository destination in my configuration. I want to backup the databases to both borg repositories. Running the backup to the first succeeds.
Expected behavior
Don't fail. Use only mariadb config that I specified.
Other notes / implementation ideas
No response
borgmatic version
2.0.12
borgmatic installation method
docker (modem7/borgmatic-docker:latest)
Borg version
borg 1.4.3
Python version
Python 3.14.2
Database version (if applicable)
No response
Operating system and version
No response
This is interesting.. There's a bunch of
MYSQL_*environment variables there that borgmatic doesn't set, includingMYSQL_HOST—which could maybe override the host that themariadb*commands try to connect to. So could something in your borgmatic container be setting those environment variables? What happens if youexecinto that container and typeenv |grep MYSQL?Hi, thanks for your response.
The output of the
env | grep MYSQLis this (with passwords redacted)so this maps to my .env
I can try to rename the MYSQL_** env vars to a different name
Ah, that explains it. Yeah, I'd recommend renaming and seeing if that fixes it. Because I'm guessing that on the second database for instance, the
MYSQL_HOSTvalue is overriding whatever borgmatic is passing to MariaDB for host. On the first database, they are the same value, so you don't see the problem there.I have changed the environment variables to use
MAIN_MYSQL_as a prefix instead ofMYSQL_, however I still get a weird error, at the end of backing up my mysql database at the first repository:there is no borgmatic.backups mysql host at all.
the
backupsis the name of the docker network, which is right. however the hostborgmaticis over written somehow.Any ideas? The backup of this repo stops,and you see the second-repo being started.
Okay, looks like I was wrong about the
MYSQL_HOSToverride theory. And now I'm pretty sure thatborgmatic.backupsis just the hostname of the borgmatic container itself... borgmatic is connecting to the database as user "root", and the "@borgmatic.backups" portion is implicit. Meaning it's just how MariaDB displays the error message. It's equivalent to saying "root@localhost".As for the actual
mariadbcommand failing, I think the most likely explanation is that the password is wrong! I can produce a very similar error message locally here when I change my MariaDB user password to be incorrect. So some thoughts on different things to try, one at a time:password_transport: environmentin the database config, which uses a different (slightly less secure) way of passing the password to themariadbclient. If that works, that probably indicates there's a problem with how borgmatic gives the password tomariadbby default.It looked like my mariadb instance got corrupted. I created a new one, and everything is working fine!
Aha! Glad to hear you got it working now.