Nextcloud Backups - error: 1045: "Access denied for user 'root'@'localhost' (using password: YES)"

Nextcloud version (eg, 20.0.5): 1.35.0
Operating system and version (eg, Ubuntu 20.04): Raspbian GNU/Linux 10 \n \l
Apache or nginx version (eg, Apache 2.4.25): Apache 2.4.38 (raspbian)
PHP version (eg, 7.4): 7.3.27-1

The issue you are facing:

I am trying to do backups to cifs connected drive on my router. The directory I have it set to says it exists but when I hit “apply” to do a backup I get the error. I had to recently change my mysql root password. I have had Nextcloud running since January and decided I should enable backups. I tried enabling and I get the following:

[ nc-backup ] (Sat May 1 13:27:23 EDT 2021)
check free space...
Maintenance mode enabled
backup database...
mysqldump: Got error: 1045: "Access denied for user 'root'@'localhost' (using password: YES)" when trying to connect
Maintenance mode disabled
Maintenance mode already disabled

Is there some place I need to update credentials in Nextcloud so I can do backups? Any help would be greatly appreciated, love being off big tech! :slight_smile:




Bro thank you so much, working great now!

Hello @OliverV

I restarted the Pi and now nextcloud won’t load. Checking logs I see:

"Access denied for user ‘ncadmin’@‘localhost’ "

I guess I need to update this password now? Any idea where I can? Thanks

  • “Had to”, Why?
  • What commands did you execute?

dbuser name is not root but ncadmin in ncp.
Mariadb root has no password Afaik, in NCP, mysql users en passwords can only be set from command line.
I’m a bit confused now, first you do something, then ask how to do it?
Nextcloud takes db credentials from /var/www/nextcloud/config/config.php
Nc-backup from /root/.my.cnf
They are auto-generated initially at installation and saved to above files.
If you change credentials, as you claim to have done, both files need to be updated.

Hey, thanks for the reply

  1. I had to because of my initial post above that you responded to. I couldn’t do nextcloud backups and I with no password I couldnt install Mediawiki (it wouldn’t accept a null password). Your suggested helped and both worked. But then when I rebooted recently, nextcloud just stopped initializing and digging in I noticed the following error:

17:33:21 nextcloudpi bash[6231]: Doctrine\DBAL\DBALException: Failed to connect to the database: An exception occurred in driver: SQLSTATE[HY000] [1045] Access denied for user 'ncadmin'@'localhost' (using password: YES) in /var/ww

  1. I executed the above commands you recommend.

Thanks for the suggestion. I will look into the config.php file.

I meant what commands you used to change the password of mariadb root user,
Before you started getting problems, asume while trying to get mediawiki running.
You should try and provide complete info on what you are trying to achieve, if you want further assist.

I did not recommend any commands, just pointers to files and docs.

Ok gotcha. Your help got me in the right direction. You are right, I didn’t include all the commands I executed before my initial post.

I just checked the config.php file you mentioned and the password wasn’t the same as my ncadmin (I knew as it was an updated one). I then logged in as root and updated it in mysql. Now Nextcloud is back up and running.

Thanks again!

1 Like

I have the exact same problem, but I got no Linux experience. Could you please share the commands exactly as these should be issued in the terminal? Thank you in advance.