MariaDB can be reverted to the fresh state by removing its data files.

Say if you run MariaDB on a Debian you can do the next:

    systemctl stop mysql
    rm -rf /var/lib/mysql/*
    sudo -u mysql mysql_install_db 
    systemctl start mysql

For some versions of Debian, the mysql_install_db step is not necessary; when starting up if no datafiles exists MariaDB will recreate the internal scheme `mysql.*` with all default values.

All leftovers like config and log files you have to clean up manually.