diff --git a/sites/all/modules/backup_migrate/includes/destinations.db.mysql.inc b/sites/all/modules/backup_migrate/includes/destinations.db.mysql.inc
index 6cd46de..ddbd81b 100644
--- a/sites/all/modules/backup_migrate/includes/destinations.db.mysql.inc
+++ b/sites/all/modules/backup_migrate/includes/destinations.db.mysql.inc
@@ -89,6 +89,7 @@ class backup_migrate_destination_db_mysql extends backup_migrate_destination_db
     $nodata = !empty($settings->filters['nodata_tables']) ? $settings->filters['nodata_tables'] : array();
     if ($file->open(TRUE)) {
       $file->write($this->_get_sql_file_header());
+      $file->write($this->_drop_unused_tables());
       $alltables = $this->_get_tables();
       foreach ($alltables as $table) {
         if (_backup_migrate_check_timeout()) {
@@ -271,6 +272,33 @@ SET NAMES utf8;
 
 ";
   }
+
+  /**
+   * Deleting tables from a database without dropping the whole database. The SQL is
+   * using MySQL specific tables and functions.
+   * Basically, the SQL is using a whitelist to identify all tables that were not part
+   * of the system while doing the backup. Once the restore process is started, those 
+   * additional tables will be dropped.
+   *
+   * Returns a SQL statement to delete all unused tables.
+   */
+  function _drop_unused_tables() {
+    $alltables = $this->_get_tables();
+    $tablenames = array_map(
+      create_function('$a', 'return "\'".$a["Name"]."\'";'), 
+      $alltables);
+    $tablelist = join (', ', $tablenames);
+    $returnstring = 
+      "SELECT @SQL:=CONCAT('DROP TABLE IF EXISTS ', group_concat(TABLE_NAME), '; ') ".
+      "FROM information_schema.tables ".
+      "WHERE table_schema = DATABASE() ".
+      "AND table_name NOT IN ($tablelist);\n";
+    $returnstring .= "SELECT IFNULL(@SQL, 'SELECT 1;') INTO @SQL;\n";
+    $returnstring .= "PREPARE stmt FROM @SQL;\n";
+    $returnstring .= "EXECUTE stmt;\n";
+    $returnstring .= "DEALLOCATE PREPARE stmt;\n\n";
+    return $returnstring;
+  }
   
   /**
    * The footer of the sql dump file.
