If you have the entire /var/lib/mysql
then you should probably try completely replacing the current contents of /var/lib/mysql
with the content you have.
Depending on your mariadb/mysql options some or all of the innodb data is global and stored in the /var/lib/mysql/ibdata1
, and /var/lib/mysql/ib_logfile
files. So just restoring the /var/lib/mysql/databasename/table*
will usually not be enough to restore innodb data.
You could temporarily move the current current contents of that directory to another location if you already have restored or started using that. Or even better temporarily start up a new machine in a VM or something where you can test restoring the entire /var/lib/mysql
directory without interrupting anything.
After placing your old data in /var/lib/mysql
you should be able to start the server and hopefully extract your data. You may need to start mariadb with the options to bypass privileges depending on how locked down your privileges were. I wouldn't continue to use that though, instead I would suggest at that point you use mysqldump or your favorite tools to dump the database, then re-import it into your production database.
As you move things back and for make sure that the mysql/mariadb service account (normally mysql/mysql) owns and has read-write access to all the files.