The data from the mariadb server is located in
/var/lib/mysql
In theory you can just replace the mysql directory and everithing should be fine.
And also in theorie and not testet currently you can create a backup from the current image (in the admin interface) and reinstall it after replacing the mysql directory.
In real live it could be that your sensor have other ids as in the old installation. Then it get tricky :D
Backup your current directory replace it and see what happend. Take a look at the user / owner settings from the directory ;)