How can I tell which site uses which database? I have a multi-site Drupal installation that's misconfigured. The settings information has been confused, and I need to map databases to particular sites. I am tasked with cleaning up the mess.

For any given database from a Drupal installation, what tables can I look at to see which site was using it?
Big giveaways will be in the variable table, especially the two rows with the names:


site_mail
site_name


As hopefully these are different for each one of your sites.

Perhaps this database query can help you:

SELECT * from variable WHERE name LIKE 'site_%';