MySQL dump - password not found / invalid #399
Reference in New Issue
Block a user
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
First, I just discovered Borg and Borgmatic, thanks for this, it looks really great ! I'm using Hetzner as backup storage for my raspberry, but it seems their is a bug with mysqldump step.
Steps to reproduce (if a bug)
Create a backup with the following configuration
Actual behavior (if a bug)
Include (sanitized)
--verbosity 2output if applicable.Expected behavior (if a bug)
As mysql password is given in configuration, I expect it to backup my database.
Other notes / implementation ideas
I excluded the bad credential password option when looking how borgmatic create MySQL dumps. It seems it use the
MYSQL_PWDenvironment variable. So I tested :and this works on my shell. Am I missing an option, or is this a bug in borgmatic/borg ?
For what it worth, my password does not contains spaces/accentuations, only characters and numbers.
As a workaround, I can still use
--skip-comments --order-by-primary -psecurePasswordand it works. From my understanding, it seems that the MYSQL_PWD variable is not defined/invalid.MySQL user permissions :
Environment
borgmatic version: [version here]
Use
sudo borgmatic --versionorsudo pip show borgmatic | grep ^Versionborgmatic installation method: [e.g., Debian package, Docker container, etc.]
installed with pip3
Borg version: [version here]
Use
sudo borg --versionPython version: [version here]
Use
python3 --versionDatabase version (if applicable): [version here]
Use
psql --versionormysql --versionon client and server.operating system and version: [OS here]
Raspberry pi OS on a raspberry pi 4
I have the exact issue as well with this mysql hook.
@djdembeck, what version of borgmatic are you using? There was a MySQL-specific fix (#470) in borgmatic 1.5.22 that may be relevant here.
I'm closing this due to inactivity. However, please feel free to re-open it or file a new ticket if you have more information. Thanks!
i stumbled across this issue as i experienced the exact same problem. i finally figured the reason for this to happen:
When you run
sudo borgmaticand have a/root/.my.cnfwith credentials in place, the password defined in /etc/borgmatic/config.yaml gets overwritten - but not the user.For example having a /root/.my.cnf with
and a borgmatic-conf with:
will result in a
mysql --user borgbut with passwordrootAh, excellent sleuthing! I'll reopen this to see if there's anything that can be done about it on the borgmatic side of things.
Edit: This may be relevant for
mysqlpassword setting / defaults file overriding.. https://unix.stackexchange.com/questions/205180/how-to-pass-password-to-mysql-command-lineI ended up just documenting around this for now. While I did consider passing
--no-defaultsto MySQL/MariaDB to make it ignore files like~/.my.cnf, in my experience it often breaks things for users relying on that kind of configuration. If anything, the trend in borgmatic is adding more ways to pass in credentials rather than taking them away.