As my XAMPP was not working properly, I have uninstalled it from my computer. While installation, I got the warning message about whether I want to delete the htdocs folder too.
According to What is the exact location of Mysql database tables in XAMPP folder?, XAMPP stores the MySQL datadir in C:\xampp\mysql\data
on Windows and /Applications/XAMPP/xamppfiles/var/mysql
on Mac. Unless you manually changed the datadir, your database files are stored in the XAMPP folder. Since that folder only has the htdocs
subdirectory now, unfortunately, your database seems to be gone. If you have file-level backups of the old system, there's a chance you can restore the database enough to recover the stored data.