Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mysqldump is not using the supplied password from the config #146

Open
dnsb opened this issue Jan 6, 2025 · 0 comments
Open

mysqldump is not using the supplied password from the config #146

dnsb opened this issue Jan 6, 2025 · 0 comments

Comments

@dnsb
Copy link

dnsb commented Jan 6, 2025

If there is another configuration, for example ~/.my.cnf, those values take precedence over the ones supplied with --defaults-extra-file if the user is not the same in .my.cnf to the configured one, the command fails with authentication error.
The behaviour is described in https://dev.mysql.com/doc/refman/8.0/en/option-file-options.html#option_general_defaults-extra-file
The problem goes away if instead of using --defaults-extra-file, the argument is changed to --defaults-file, because in this case the other configuration files don't take precedence over the supplied values.
In backup-manager/backup-methods.sh

base_command="$mysqldump --defaults-file=$mysql_conffile $opt -u$BM_MYSQL_ADMINLOGIN -h$BM_MYSQL_HOST -P$BM_MYSQL_PORT $BM_MYSQL_EXTRA_OPTIONS"
...
DBNAMES=$($mysql --defaults-file=$mysql_conffile -u $BM_MYSQL_ADMINLOGIN -h $BM_MYSQL_HOST -P $BM_MYSQL_PORT -B -N -e "show databases" | sed 's/ /%/g')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant