Backup database question


found this command to backup my SQL database:

mysqldump --lock-tables -h [server] -u [username] -p[password] [db_name] > nextcloud-sqlbkp_date +"%Y%m%d".bak

What value shall I use for “server”? Is this the domain name or name of the webserver configuration file?

Kind regards

No, it’s the name of your database server. If it’s on the same machine, you can use localhost or even don’t set this value as this is the default setting.

For backing up my database I use this script with cron

ZEIT=`date +%d.%m.%y__%T`
echo ">>>  $ZEIT busql START" >> /media/bu/mountbu.log
MONAT=`date +%m`
DATZEIT=`date +%d%H%M`
mkdir -p /media/bu/sql/$MONAT
mysqldump -u root -pPASSWORD nextcloud > /media/bu/sql/$MONAT/$DATZEIT.sql
ZEIT=`date +%d.%m.%y__%T`
echo "<<<  $ZEIT busql ENDE" >> /media/bu/mountbu.log