Database backup permissions issue [solved]

Good morning all!
I have an installation of NextCloud (18.06) on my remote VPN which has functioned very well for the last year or so. However, one issue I am facing is that the backup process is failing.
Having looked into this in more detail, I have found the following error message is being emailed to me daily:

processing nextclouddb
mysqldump: Got error: 1045: "Access denied for user '-p'@'localhost' (using password: YES)" when trying to connect

I have the settings in config.php according to what is expected:

'datadirectory' => '/var/www/html/nextcloud/data',
'dbtype' => 'mysql',
'version' => '18.0.6.0',
'overwrite.cli.url' => 'https://www.applied-jidoka.com/nextcloud',
'dbname' => 'nextclouddb',
'dbhost' => 'localhost',
'dbport' => '',
'dbtableprefix' => 'oc_',
'mysql.utf8mb4' => true,
'dbuser' => 'nextclouduser',
'dbpassword' => '****',
'installed' => true,

Obviously I have left out the password and other secrets etc.

I am struggling to see where the command for backing up the database is being triggered from. Looking for this error online isn’t finding anyone else with this problem.

I would appreciate hearing your suggestions to resolve this issue. At the moment, I am unable to run the updater as part of that process is backing up the database.

Many thanks.

edit: I moved this from installation to support - that seems more appropriate for this issue.

If it is running regularly, just check the list of cronjobs running on your server, the script should be part of it.

If you have the username and password and you have some webinterface for the db (e.g. phpmyadmin), you can try and connect to see if this user has access.

That was a good tip @tflidd. In fact, the task was not showing in the regular crontabs for root or www-data (the only two crontabs installed), but was installed in the system crontab at /etc/crontab. This is running a script under /root/cron_scripts called backup_mysql.sh. It is nothing to do with the Nextcloud installation - I installed it when setting up the lamp server originally. Looks like I need to do some work to allow it to backup the nextcloud database (including entry/exit from maintenance mode if I understand the documentation correctly!).

Thanks for your help.