diff --git a/core/lib/Drupal/Core/Database/Install/Tasks.php b/core/lib/Drupal/Core/Database/Install/Tasks.php
index c4d88d2..8c81851 100644
--- a/core/lib/Drupal/Core/Database/Install/Tasks.php
+++ b/core/lib/Drupal/Core/Database/Install/Tasks.php
@@ -37,6 +37,20 @@
       'arguments'   => array(),
     ),
     array(
+      // The {drupal_install_test} table may exist from a previous failed
+      // installation attempt. Running this task first allows the other tasks
+      // to proceed and guarantees that we will always run at least one test
+      // for both DROP and CREATE.
+      'function'    => 'runTestQueryIfTableExists',
+      'arguments'   => array(
+        'drupal_install_test',
+        'DROP TABLE {drupal_install_test}',
+        'Drupal can use DROP TABLE database commands.',
+        'Failed to <strong>DROP</strong> a test table from your database server. We tried dropping a table with the command %query and the server reported the following error %error.',
+        TRUE,
+      ),
+    ),
+    array(
       'arguments'   => array(
         'CREATE TABLE {drupal_install_test} (id int NULL)',
         'Drupal can use CREATE TABLE database commands.',
@@ -305,4 +319,30 @@ public function validateDatabaseSettings($database) {
     return $errors;
   }
 
+  /**
+   * Run a test query only if a specified database table exists.
+   *
+   * @param $table
+   *   The database table to check.
+   * @param $query
+   *   Passed as an argument to runTestQuery() when the database table exists.
+   * @param $pass
+   *   Passed as an argument to runTestQuery() when the database table exists.
+   * @param $fail
+   *   Passed as an argument to runTestQuery() when the database table exists.
+   * @param $fatal
+   *   (optional) Passed as an argument to runTestQuery() when the database
+   *   table exists. Defaults to FALSE.
+   *
+   * @return
+   *   NULL if the query ran successfully or did not need to run, TRUE for a
+   *   non-fatal failure while running the query, and FALSE for a fatal
+   *   failure.
+   */
+  protected function runTestQueryIfTableExists($table, $query, $pass, $fail, $fatal = FALSE) {
+    if (Database::getConnection()->schema()->tableExists($table)) {
+      return $this->runTestQuery($query, $pass, $fail, $fatal);
+    }
+  }
+
 }
