Please see the first section “Export your MySQL/MariaDB database in a file” in our FAQ “How do I backup and restore the Matomo data?”.