Nextcloud Install MySql Backup

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?

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.

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.