FIX! for Virtualmin Backup - mysqldump failing - Got error: 1045: Access denied

If your virtualmin backups are failing with this error:

mysqldump: Got error: 1045: Access denied for user ‘someuser’@‘localhost’ (using password: YES) when trying to connect

it is caused by a recent virtualmin update that means virtualmin will use the webuser for the backup job, and your server does not have the mysql permissions set up for the user.

Do the following:
Click webmin -> Servers -> MySQL Database Server
Now on the right click “User Permissions” under Global Options

A list of users is now shown. Find the offending user in the list - my example above is ‘someuser’ and click the user name in the User column where ‘localhost’ is in the Hosts column.

A form is shown. In the permissions box you need to select both ‘Select table data’ AND ‘Show databases’. You need to hold down the CTRL key (Command on mac?) when clicking to multi select.

Click the [Save] button. Job done.

You may need to repeat for all users related to a virtualmin domain. If one backup is failing they all are!

I hope that helps,