I installed automysqlbackup via the apt packager manager via sudo apt install automysqlbackup.


sudo automysqlbackup worked fine with 14.04 but starting with 16.04, it doesn't work anymore once in mysql I do update mysql.user set plugin='mysql_native_password' where user='root'; with Error ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)


Since update mysql.user set plugin='unix_socket' where user='root'; will work with sudo automysqlbackup, I created a new config file (automysqlbackup.conf) in hope that by specifiying a config file with needed entries I can amend this issue. But running sudo automysqlbackup /etc/automysqlbackup/automysqlbackup.conf still outputs the same error ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO). As a result, somehow sudo automyslbackup doesn't seem to take the config file into account. Do you guys have any clue why this is so?

1 Answer 1


automysqlbackup is a script, you can take a look at the code.

If you have installed it, open it with

sudo nano /usr/sbin/automysqlbackup

Here you will find at ~ line 106 an options documa(e)ntation.

In Ubuntu 16.04/18.04 it reads the configuration from /etc/default/automysqlbackup if it exists. I don't think it takes any command-line arguments.

In my case, I had to set the USERNAME and PASSWORD variables in the /etc/default/automysqlbackup. I also had to change the DBNAMES line. I removed the --defaults-file parameter and added the --user=${USERNAME} --password=${PASSWORD}.

  • If you have a .my.cnf in the root directory, you can set it like this (to avoid hardcoding it): PASSWORD=grep password /root/.my.cnf | tail -n 1 | cut -d"=" -f2 | awk '{print $1}'
    – Palantir
    Oct 19, 2020 at 9:20

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .