Backup Nextcloud with seperate DATA folder and the database?!?!?

Hi there,

rsync -Aax /var/nextclouddata/ /media/ncbackup/data/

Would cover your data dir, as you can see you just change the paths as required, leaving a slash on the end for all data within that directory.

mysqldump --lock-tables -u root -psecret nextclouddb > /media/ncbackup/database/nextcloud-sqlbkp_date +"%Y%m%d".bak

Run this as the user with permission to export the database. It may be root, it may be the ncdb user, that depends on your setup. Also presumably the database is on the local machine, so no need for the -h flag.