I have automysqlbackup installed on debian. I added USERNAME and PASSWORD to /etc/default/automysqlbackup
, but when automysqlbackup runs, I get the output:
/etc/cron.daily/automysqlbackup:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO
as if I would not have configured any credentials.
The automysqlbackup config is the default configuration with two lines added at the end:
USERNAME=root
PASSWORD="the root password"
The default config tries to get the credentials from /etc/mysql/debian.cnf
(using grep in the /etc/default/automysqlbackup
bash snippet) which contains a warning that the file is deprecated and does not contain any admin password anymore on new installations.
I tried automysqlbackup with strace and it at least reads /etc/default/automysqlbackup
even when not started by cron. It doesn't use the password, though.
The problem was to append the USERNAME and PASSWORD at the end of the file, while the file is evaluated as shellscript and contains some
mysql
commands to list database names that already require a login.It also seems to make strong assumentions that
debian.cnf
is available and contains the needed credentials, by finding databases like this:which would probably need parameters to use
$USERNAME
and$PASSWORD
instead of the deprecated defaults file.I know that old mysql/mariadb packages configured a maintenance user in
debian.cnf
but a fresh install does not contain such a account and so the script already fails when trying to list the databases.The configuration file already contains a commented out alternative that seems to work:
I must say, that both lines look a bit fragile to me. I am not sure if this won't break sometime and if the whole automysqlbackup script or at least its configuration may not be the most robust solution.