Backup
mysqldump --user=mysqluser --password=mysqluserpassword --all-databases > /backup/backupname_`date +"%Y%m%d"`.sql
Restore
$ mysql -uroot -p
Enter password:
MariaDB [(none)]> use databasename;
MariaDB [databasename]>source /path/to/the/backup/sqlfile.sql;