Nextcloud Install MySql Backup

Having issues with your DietPi installation, or, found a bug? Post it here.
Post Reply
carltonb
Posts: 6
Joined: Mon Oct 17, 2016 9:57 pm

Nextcloud Install MySql Backup

Post by carltonb »

I want to back up the MySql database. I found that the username is root and passwd is dietpi, but when I do a basic
mysqldump nextcloud > nextcloud.sql it gives me an error as follows.
mysqldump: Got error: 1932: "Table 'nextcloud.oc_twofactor_totp_secrets' doesn't exist in engine" when using LOCK TABLES

If I try mysqldump --single-transaction -u [username] -p [password] nextcloud > nextcloud-sqlbkp_`date +"%Y%m%d"`.bak
no matter what I use for the username or password root/dietpi or the ones I have changed to it gives me an
mysqldump: Got error: 1045: "Access denied for user '-p'@'localhost' (using password: NO)" when trying to connect

Any thoughts?

Also does the Dietpi backup utility just back up the card, files?
Thanks
Carltonb
User avatar
MichaIng
Site Admin
Posts: 2295
Joined: Sat Nov 18, 2017 6:21 pm

Re: Nextcloud Install MySql Backup

Post by MichaIng »

What distro version are you using, and do you really use MySQL or actuall MariaDB (which can be seen by opening mysql -uroot)?

On Stretch, by apt install mysql-server actually mariadb will be installed though some dummy package redirection.

On MariaDB by default unix_socket authentication is active, thus no password is needed and no authentication to -uroot from any other unix user than root is impossible. On Jessie it does not even allow to connect, if you add "-p..." to your mysql command. On Stretch and above it will be just ignored.

On my server, my VMs and within DietPi we use mysqldump --lock-tables -h localhost -uroot -pdietpi nextcloud > mysql_backup.sql without any issues. On Jessie+MariaDB as said, you NEED to remove -pdietpi.
carltonb
Posts: 6
Joined: Mon Oct 17, 2016 9:57 pm

Re: Nextcloud Install MySql Backup

Post by carltonb »

Thank you for the reply.
I am running stretch.
Apache install with Nextcloud, though it says MySql installed.
Do not know if running MariaDB because if I try to use mysql -uroot to find out I get the follwoing error message.
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (111 "Connection refused")

When I have run into this in the past it means my server is not all there. Do not want to fool with it quiet yet until I get a reply.

Carltonb
Post Reply