I have a backup of the entire xampp/mysql
folder. How can I use it to recover my old db on a fresh installation of XAMPP?
Simply copying the old
You cannot copy a database folder that has InnoDB tables because InnoDB storage engine maintains a symbiotic relationship between the InnoDB tables' physical files (frm and .ibd) and the data dictionary.
Reference: https://dba.stackexchange.com/questions/82093/moving-binary-database-folder-is-causing-issues-with-innodb-tables
You can try (InnoDB part): https://dba.stackexchange.com/questions/57120/recover-mysql-database-from-data-folder-without-ibdata1-from-ibd-files/57157#57157
Recommendation: It might be late in your case, however, before you move to another server, it is a good idea to export your databases to a sql file and Import it from phpmyadmin, Mysql Workbech, SQLyog or terminal
Export:
mysqldump -u user -p password database_name > database_name.sql
Import
mysql -u user -p password database_name < database_name.sql