diff --git a/core/includes/install.inc b/core/includes/install.inc
index 3529d51..96b366c 100644
--- a/core/includes/install.inc
+++ b/core/includes/install.inc
@@ -6,6 +6,7 @@
  */
 
 use Drupal\Component\Utility\Unicode;
+use Drupal\Core\Database\DatabaseDriverDiscovery;
 use Symfony\Component\HttpFoundation\RedirectResponse;
 use Drupal\Component\Utility\Crypt;
 use Drupal\Component\Utility\OpCodeCache;
@@ -141,15 +142,16 @@ function drupal_install_profile_distribution_version() {
  *
  * @return
  *   An array of database types compiled into PHP.
+ *
+ * @deprecated in Drupal 8.5.0, will be removed before Drupal 9.0.0. Use
+ *   \Drupal\Core\Database\DatabaseDriverDiscovery::getInstallableDriversInstallerNames
+ *   instead.
+ *
+ * @see https://www.drupal.org/node/2896416
  */
 function drupal_detect_database_types() {
-  $databases = drupal_get_database_types();
-
-  foreach ($databases as $driver => $installer) {
-    $databases[$driver] = $installer->name();
-  }
-
-  return $databases;
+  @trigger_error('drupal_detect_database_types() is deprecated in Drupal 8.5.0, will be removed before Drupal 9.0.0. Use \Drupal\Core\Database\DatabaseDriverDiscovery::getInstallableDriversInstallerNames instead. See https://www.drupal.org/node/2896416.', E_USER_DEPRECATED);
+  return (new DatabaseDriverDiscovery())->getInstallableDriversInstallerNames();
 }
 
 /**
@@ -157,37 +159,16 @@ function drupal_detect_database_types() {
  *
  * @return \Drupal\Core\Database\Install\Tasks[]
  *   An array of available database driver installer objects.
+ *
+ * @deprecated in Drupal 8.5.0, will be removed before Drupal 9.0.0. Use
+ *   \Drupal\Core\Database\DatabaseDriverDiscovery::getInstallableDriversInstallers
+ *   instead.
+ *
+ * @see https://www.drupal.org/node/2896416
  */
 function drupal_get_database_types() {
-  $databases = [];
-  $drivers = [];
-
-  // The internal database driver name is any valid PHP identifier.
-  $mask = '/^' . DRUPAL_PHP_FUNCTION_PATTERN . '$/';
-  $files = file_scan_directory(DRUPAL_ROOT . '/core/lib/Drupal/Core/Database/Driver', $mask, ['recurse' => FALSE]);
-  if (is_dir(DRUPAL_ROOT . '/drivers/lib/Drupal/Driver/Database')) {
-    $files += file_scan_directory(DRUPAL_ROOT . '/drivers/lib/Drupal/Driver/Database/', $mask, ['recurse' => FALSE]);
-  }
-  foreach ($files as $file) {
-    if (file_exists($file->uri . '/Install/Tasks.php')) {
-      $drivers[$file->filename] = $file->uri;
-    }
-  }
-  foreach ($drivers as $driver => $file) {
-    $installer = db_installer_object($driver);
-    if ($installer->installable()) {
-      $databases[$driver] = $installer;
-    }
-  }
-
-  // Usability: unconditionally put the MySQL driver on top.
-  if (isset($databases['mysql'])) {
-    $mysql_database = $databases['mysql'];
-    unset($databases['mysql']);
-    $databases = ['mysql' => $mysql_database] + $databases;
-  }
-
-  return $databases;
+  @trigger_error('drupal_get_database_types() is deprecated in Drupal 8.5.0, will be removed before Drupal 9.0.0. Use \Drupal\Core\Database\DatabaseDriverDiscovery::getInstallableDriversInstallers instead. See https://www.drupal.org/node/2896416.', E_USER_DEPRECATED);
+  return (new DatabaseDriverDiscovery())->getInstallableDriversInstallers();
 }
 
 /**
@@ -1107,16 +1088,13 @@ function install_profile_info($profile, $langcode = 'en') {
  *
  * @return \Drupal\Core\Database\Install\Tasks
  *   A class defining the requirements and tasks for installing the database.
+ *
+ * @deprecated in Drupal 8.5.0, will be removed before Drupal 9.0.0. Use
+ *   \Drupal\Core\Database\DatabaseDriverDiscovery::getInstaller instead.
+ *
+ * @see https://www.drupal.org/node/2896416
  */
 function db_installer_object($driver) {
-  // We cannot use Database::getConnection->getDriverClass() here, because
-  // the connection object is not yet functional.
-  $task_class = "Drupal\\Core\\Database\\Driver\\{$driver}\\Install\\Tasks";
-  if (class_exists($task_class)) {
-    return new $task_class();
-  }
-  else {
-    $task_class = "Drupal\\Driver\\Database\\{$driver}\\Install\\Tasks";
-    return new $task_class();
-  }
+  @trigger_error('db_installer_object() is deprecated in Drupal 8.5.0, will be removed before Drupal 9.0.0. Use \Drupal\Core\Database\DatabaseDriverDiscovery::getInstaller instead. See https://www.drupal.org/node/2896416.', E_USER_DEPRECATED);
+  return (new DatabaseDriverDiscovery())->getInstaller($driver);
 }
diff --git a/core/lib/Drupal/Core/Database/Connection.php b/core/lib/Drupal/Core/Database/Connection.php
index 100ef68..7ab5f2c 100644
--- a/core/lib/Drupal/Core/Database/Connection.php
+++ b/core/lib/Drupal/Core/Database/Connection.php
@@ -2,6 +2,8 @@
 
 namespace Drupal\Core\Database;
 
+use Psr\Http\Message\UriInterface;
+
 /**
  * Base Database API class.
  *
@@ -1472,4 +1474,62 @@ public function __sleep() {
     throw new \LogicException('The database connection is not serializable. This probably means you are serializing an object that has an indirect reference to the database connection. Adjust your code so that is not necessary. Alternatively, look at DependencySerializationTrait as a temporary solution.');
   }
 
+  /**
+   * A helper function to convert a URI into connection options.
+   *
+   * @internal
+   *   This method should not be called. Use
+   *   \Drupal\Core\Database\Database::convertDbUrlToConnectionInfo() instead.
+   *
+   * @param \Psr\Http\Message\UriInterface $uri
+   *   The URI to be converted to a connection array.
+   * @param string $root
+   *   The root directory of the Drupal installation.
+   * @param array $connection_options
+   *   The connection options.
+   *
+   * @return array
+   *   The connection options.
+   *
+   * @see \Drupal\Core\Database\Database::convertDbUrlToConnectionInfo()
+   */
+  public static function convertDbUrlToConnectionInfoHelper(UriInterface $uri, $root, array $connection_options) {
+    $port = $uri->getPort();
+    if (!empty($port)) {
+      $connection_options['port'] = $port;
+    }
+    $user_info = explode(':', $uri->getUserInfo(), 2);
+    $connection_options['username'] = $user_info[0];
+    $connection_options['password'] = isset($user_info[1]) ? $user_info[1] : '';
+
+    return $connection_options;
+  }
+
+  /**
+   * A helper function to convert connection options into a URI.
+   *
+   * @internal
+   *   This method should not be called. Use
+   *   \Drupal\Core\Database\Database::getConnectionInfoAsUrl() instead.
+   *
+   * @param array $connection_options
+   *   The array of connection options for a database connection.
+   * @param \Psr\Http\Message\UriInterface $uri
+   *   The URI to connect to the database.
+   *
+   * @return $this|\Psr\Http\Message\UriInterface
+   *   The URI to connect to the database.
+   *
+   * @see \Drupal\Core\Database\Database::getConnectionInfoAsUrl()
+   */
+  public static function getConnectionInfoAsUrlHelper(array $connection_options, UriInterface $uri) {
+    $user = isset($connection_options['username']) ? $connection_options['username'] : '';
+    $password = isset($connection_options['password']) ? $connection_options['password'] : '';
+    $uri = $uri->withUserInfo($user, $password);
+    if (!empty($connection_options['port'])) {
+      $uri = $uri->withPort($connection_options['port']);
+    }
+    return $uri;
+  }
+
 }
diff --git a/core/lib/Drupal/Core/Database/Database.php b/core/lib/Drupal/Core/Database/Database.php
index dd19018..12d8f41 100644
--- a/core/lib/Drupal/Core/Database/Database.php
+++ b/core/lib/Drupal/Core/Database/Database.php
@@ -2,6 +2,8 @@
 
 namespace Drupal\Core\Database;
 
+use GuzzleHttp\Psr7\Uri;
+
 /**
  * Primary front-controller for the database system.
  *
@@ -365,13 +367,8 @@
       throw new DriverNotSpecifiedException('Driver not specified for this database connection: ' . $key);
     }
 
-    if (!empty(self::$databaseInfo[$key][$target]['namespace'])) {
-      $driver_class = self::$databaseInfo[$key][$target]['namespace'] . '\\Connection';
-    }
-    else {
-      // Fallback for Drupal 7 settings.php.
-      $driver_class = "Drupal\\Core\\Database\\Driver\\{$driver}\\Connection";
-    }
+    $namespace = static::getDatabaseDriverNamespace(self::$databaseInfo[$key][$target]);
+    $driver_class = $namespace . '\\Connection';
 
     $pdo_connection = $driver_class::open(self::$databaseInfo[$key][$target]);
     $new_connection = new $driver_class($pdo_connection, self::$databaseInfo[$key][$target]);
@@ -455,36 +452,36 @@ public static function ignoreTarget($key, $target) {
    *   requirements.
    */
   public static function convertDbUrlToConnectionInfo($url, $root) {
-    $info = parse_url($url);
-    if (!isset($info['scheme'], $info['host'], $info['path'])) {
+    $uri = new Uri($url);
+    if (empty($uri->getHost()) || empty($uri->getScheme()) || empty($uri->getPath())) {
       throw new \InvalidArgumentException('Minimum requirement: driver://host/database');
     }
-    $info += [
-      'user' => '',
-      'pass' => '',
-      'fragment' => '',
-    ];
-
-    // A SQLite database path with two leading slashes indicates a system path.
-    // Otherwise the path is relative to the Drupal root.
-    if ($info['path'][0] === '/') {
-      $info['path'] = substr($info['path'], 1);
-    }
-    if ($info['scheme'] === 'sqlite' && $info['path'][0] !== '/') {
-      $info['path'] = $root . '/' . $info['path'];
+    // Discover if the URL has a driver namespace.
+    $scheme = $uri->getScheme();
+    $discovery = new DatabaseDriverDiscovery();
+    $drivers = $discovery->discoverDatabaseDrivers();
+    if (!isset($drivers[$scheme])) {
+      throw new \Exception("Drupal database driver not available: '" . $uri->getScheme() . "'");
     }
-
-    $database = [
-      'driver' => $info['scheme'],
-      'username' => $info['user'],
-      'password' => $info['pass'],
-      'host' => $info['host'],
-      'database' => $info['path'],
+    $namespace = $drivers[$scheme]['namespace'];
+    $fragment = $uri->getFragment();
+    $connection_options = [
+      'driver' => $uri->getScheme(),
+      'host' => $uri->getHost(),
+      // Strip the first leading slash of the path to get the database name.
+      // Note that additional leading slashes have meaning for some database
+      // drivers.
+      'database' => substr($uri->getPath(), 1),
+      'prefix' => $fragment ?: NULL,
+      'namespace' => $namespace,
     ];
-    if (isset($info['port'])) {
-      $database['port'] = $info['port'];
+
+    $namespace = static::getDatabaseDriverNamespace($connection_options);
+    $driver_class = $namespace . '\\Connection';
+    if (!class_exists($driver_class)) {
+      throw new \RuntimeException("Can not convert $url to a database connection, class $driver_class does not exist");
     }
-    return $database;
+    return $driver_class::convertDbUrlToConnectionInfoHelper($uri, $root, $connection_options);
   }
 
   /**
@@ -498,29 +495,62 @@ public static function convertDbUrlToConnectionInfo($url, $root) {
    */
   public static function getConnectionInfoAsUrl($key = 'default') {
     $db_info = static::getConnectionInfo($key);
-    if ($db_info['default']['driver'] == 'sqlite') {
-      $db_url = 'sqlite://localhost/' . $db_info['default']['database'];
+    if (empty($db_info)) {
+      throw new \RuntimeException("Database connection $key not defined");
     }
-    else {
-      $user = '';
-      if ($db_info['default']['username']) {
-        $user = $db_info['default']['username'];
-        if ($db_info['default']['password']) {
-          $user .= ':' . $db_info['default']['password'];
-        }
-        $user .= '@';
-      }
+    return static::convertConnectionInfoToUrl($db_info);
+  }
 
-      $db_url = $db_info['default']['driver'] . '://' . $user . $db_info['default']['host'];
-      if (isset($db_info['default']['port'])) {
-        $db_url .= ':' . $db_info['default']['port'];
-      }
-      $db_url .= '/' . $db_info['default']['database'];
+  /**
+   * Convert a database connection info array to a URL.
+   *
+   * @param array $db_info
+   *   The database connection info.
+   *
+   * @return string
+   *   The connection info as a URL.
+   */
+  public static function convertConnectionInfoToUrl($db_info) {
+
+    $namespace = static::getDatabaseDriverNamespace($db_info['default']);
+    $driver_class = $namespace . '\\Connection';
+
+    // Some database driver do not need a host setting to work but in order to
+    // be converted into a URL they do.
+    $host = isset($db_info['default']['host']) ? $db_info['default']['host'] : 'localhost';
+
+    // Create a URI with the minimum requirement of driver://host/database.
+    $uri = new Uri();
+    $uri = $uri->withScheme($db_info['default']['driver'])
+      ->withHost($host)
+      ->withPath('/' . $db_info['default']['database']);
+
+    if (!empty($db_info['default']['prefix']['default'])) {
+      $uri = $uri->withFragment($db_info['default']['prefix']['default']);
     }
-    if ($db_info['default']['prefix']['default']) {
-      $db_url .= '#' . $db_info['default']['prefix']['default'];
+
+    $uri = $driver_class::getConnectionInfoAsUrlHelper($db_info['default'], $uri);
+    return (string) $uri;
+  }
+
+  /**
+   * Gets the PHP namespace of a database driver.
+   *
+   * @param array $connection_info
+   *   The database connection information, as defined in settings.php. The
+   *   structure of this array depends on the database driver it is connecting
+   *   to.
+   *
+   * @return string
+   *   The PHP namespace of the driver's database.
+   */
+  public static function getDatabaseDriverNamespace(array $connection_info) {
+    if (isset($connection_info['namespace']) && $connection_info['namespace'] !== NULL) {
+      return $connection_info['namespace'];
     }
-    return $db_url;
+
+    // Fallback for Drupal 7 settings.php.
+    return 'Drupal\\Core\\Database\\Driver\\' . $connection_info['driver'];
   }
 
 }
diff --git a/core/lib/Drupal/Core/Database/DatabaseDriverDiscovery.php b/core/lib/Drupal/Core/Database/DatabaseDriverDiscovery.php
new file mode 100644
index 0000000..dba8564
--- /dev/null
+++ b/core/lib/Drupal/Core/Database/DatabaseDriverDiscovery.php
@@ -0,0 +1,140 @@
+<?php
+
+namespace Drupal\Core\Database;
+
+/**
+ * Performs database driver discovery.
+ */
+class DatabaseDriverDiscovery {
+
+  /**
+   * Directory locations for database drivers.
+   *
+   * See composer.json for discoverable namespaces.
+   *
+   * @var array
+   */
+  protected static $discoveryLocations = [
+    'Drupal\\Core\\Database\\Driver' => __DIR__ . '/Driver',
+    'Drupal\\Driver\\Database' => __DIR__ . '/../../../../../drivers/lib/Drupal/Driver/Database',
+  ];
+
+  /**
+   * Discovered database drivers.
+   *
+   * @var array
+   */
+  protected static $discoveredDrivers;
+
+  /**
+   * Returns the installer name of the installable database drivers.
+   *
+   * @return \Drupal\Core\StringTranslation\TranslatableMarkup[]
+   *   An associative array with key the database driver name, and value the
+   *   name of database driver as presented by the installer.
+   */
+  public function getInstallableDriversInstallerNames() {
+    $installable_drivers_installers_names = [];
+
+    foreach ($this->getInstallableDriversInstallers() as $driver_name => $installer) {
+      $installable_drivers_installers_names[$driver_name] = $installer->name();
+    }
+
+    return $installable_drivers_installers_names;
+  }
+
+  /**
+   * Returns the installer objects of the installable database drivers.
+   *
+   * @return \Drupal\Core\Database\Install\Tasks[]
+   *   An associative array with key the database driver name, and value the
+   *   installer object.
+   */
+  public function getInstallableDriversInstallers() {
+    $installable_drivers_installers = [];
+
+    foreach ($this->discoverDatabaseDrivers() as $driver_name => $info) {
+      if ($info['installable'] === TRUE) {
+        $installable_drivers_installers[$driver_name] = $info['installer'];
+      }
+    }
+
+    // Usability: unconditionally put the MySQL driver on top.
+    if (isset($installable_drivers_installers['mysql'])) {
+      $mysql_driver_installer = $installable_drivers_installers['mysql'];
+      unset($installable_drivers_installers['mysql']);
+      $installable_drivers_installers = ['mysql' => $mysql_driver_installer] + $installable_drivers_installers;
+    }
+
+    return $installable_drivers_installers;
+  }
+
+  /**
+   * Returns a database installer object.
+   *
+   * @param string $driver_name
+   *   The name of the driver.
+   *
+   * @return \Drupal\Core\Database\Install\Tasks
+   *   A class defining the requirements and tasks for installing the database.
+   */
+  public function getInstaller($driver_name) {
+    return $this->discoverDatabaseDrivers()[$driver_name]['installer'];
+  }
+
+  /**
+   * Discovers the available database drivers.
+   *
+   * @return array
+   *   An associative array with key the database driver name, and value an
+   *   associative array bearing the following keys and values:
+   *   - 'connectionClass' => the FQCN of the Connection class for this driver;
+   *   - 'installer' => the database driver installer object;
+   *   - 'installable' => whether the database driver can be installed.
+   */
+  public function discoverDatabaseDrivers() {
+    if (isset(static::$discoveredDrivers)) {
+      return static::$discoveredDrivers;
+    }
+
+    // Scan the discovery locations and build an array of candidate discovered
+    // drivers.
+    $candidate_drivers = [];
+    foreach (static::$discoveryLocations as $namespace => $location) {
+      if (is_dir($location) && ($handle = @opendir($location))) {
+        // Each database driver name should correspond to a subdirectory of the
+        // location being scanned.
+        while (($driver_name = readdir($handle)) != FALSE) {
+          // Skip this file if it starts with a dot.
+          if ($driver_name[0] != '.') {
+            if (isset($candidate_drivers[$driver_name])) {
+              throw new \RuntimeException("Duplicate database driver name found: " . $driver_name);
+            }
+            $candidate_drivers[$driver_name] = $namespace . '\\' . $driver_name;
+          }
+        }
+      }
+    }
+
+    // Loops through the candidates and build the array of discovered drivers.
+    // Use class_exist to check that actual classes for Connection and
+    // Install\Tasks are defined and can be loaded.
+    foreach ($candidate_drivers as $driver_name => $namespace) {
+      static::$discoveredDrivers[$driver_name]['namespace'] = $namespace;
+
+      $connection_class = $namespace . '\\Connection';
+      if (class_exists($connection_class)) {
+        static::$discoveredDrivers[$driver_name]['connectionClass'] = $connection_class;
+      }
+
+      $install_tasks_class = $namespace . '\\Install\\Tasks';
+      if (class_exists($install_tasks_class)) {
+        $installer = new $install_tasks_class();
+        static::$discoveredDrivers[$driver_name]['installer'] = $installer;
+        static::$discoveredDrivers[$driver_name]['installable'] = $installer->installable();
+      }
+    }
+
+    return static::$discoveredDrivers;
+  }
+}
diff --git a/core/lib/Drupal/Core/Database/Driver/sqlite/Connection.php b/core/lib/Drupal/Core/Database/Driver/sqlite/Connection.php
index a7c1496..6eade7e 100644
--- a/core/lib/Drupal/Core/Database/Driver/sqlite/Connection.php
+++ b/core/lib/Drupal/Core/Database/Driver/sqlite/Connection.php
@@ -5,6 +5,7 @@
 use Drupal\Core\Database\Database;
 use Drupal\Core\Database\DatabaseNotFoundException;
 use Drupal\Core\Database\Connection as DatabaseConnection;
+use Psr\Http\Message\UriInterface;
 
 /**
  * SQLite implementation of \Drupal\Core\Database\Connection.
@@ -436,4 +437,30 @@ public function getFullQualifiedTableName($table) {
     return $prefix . $table;
   }
 
+  /**
+   * {@inheritdoc}
+   */
+  public static function convertDbUrlToConnectionInfoHelper(UriInterface $uri, $root, array $database) {
+    // A SQLite database with a leading slash indicates a system path.
+    // Otherwise the path is relative to the Drupal root.
+    if ($database['database'][0] !== '/') {
+      $database['database'] = $root . '/' . $database['database'];
+    }
+    // The host setting is meaningless for SQLite databases.
+    unset($database['host']);
+    return $database;
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public static function getConnectionInfoAsUrlHelper(array $connection_options, UriInterface $uri) {
+    if ($connection_options['database'][0] === '/') {
+      // If the database is an absolute path add an additional leading slash to
+      // denote this.
+      $uri = $uri->withPath('/' . $connection_options['database']);
+    }
+    return $uri;
+  }
+
 }
diff --git a/core/modules/simpletest/simpletest.module b/core/modules/simpletest/simpletest.module
index 0e0ea2a..02ecf8f 100644
--- a/core/modules/simpletest/simpletest.module
+++ b/core/modules/simpletest/simpletest.module
@@ -316,9 +316,11 @@ function simpletest_phpunit_configuration_filepath() {
  */
 function simpletest_phpunit_run_command(array $unescaped_test_classnames, $phpunit_file, &$status = NULL, &$output = NULL) {
   global $base_url;
-  // Setup an environment variable containing the database connection so that
-  // functional tests can connect to the database.
-  putenv('SIMPLETEST_DB=' . Database::getConnectionInfoAsUrl());
+  if (Database::getConnectionInfo()) {
+    // Setup an environment variable containing the database connection so that
+    // functional tests can connect to the database.
+    putenv('SIMPLETEST_DB=' . Database::getConnectionInfoAsUrl());
+  }
 
   // Setup an environment variable containing the base URL, if it is available.
   // This allows functional tests to browse the site under test. When running
diff --git a/core/modules/system/tests/src/Kernel/Scripts/DbCommandBaseTest.php b/core/modules/system/tests/src/Kernel/Scripts/DbCommandBaseTest.php
index cb7f5eb..f8eef85 100644
--- a/core/modules/system/tests/src/Kernel/Scripts/DbCommandBaseTest.php
+++ b/core/modules/system/tests/src/Kernel/Scripts/DbCommandBaseTest.php
@@ -1,5 +1,4 @@
 <?php
-
 /**
  * @file
  * Contains \Drupal\Tests\system\Kernel\Scripts\DbCommandBaseTest.
@@ -58,18 +57,16 @@ public function testSpecifyDatabaseDoesNotExist() {
    * Test supplying database connection as a url.
    */
   public function testSpecifyDbUrl() {
-    $connection_info = Database::getConnectionInfo('default')['default'];
-
     $command = new DbCommandBaseTester();
     $command_tester = new CommandTester($command);
     $command_tester->execute([
-      '-db-url' => $connection_info['driver'] . '://' . $connection_info['username'] . ':' . $connection_info['password'] . '@' . $connection_info['host'] . '/' . $connection_info['database']
+      '-db-url' => Database::getConnectionInfoAsUrl('default')
     ]);
     $this->assertEquals('db-tools', $command->getDatabaseConnection($command_tester->getInput())->getKey());
 
     Database::removeConnection('db-tools');
     $command_tester->execute([
-      '--database-url' => $connection_info['driver'] . '://' . $connection_info['username'] . ':' . $connection_info['password'] . '@' . $connection_info['host'] . '/' . $connection_info['database']
+      '--database-url' => Database::getConnectionInfoAsUrl('default')
     ]);
     $this->assertEquals('db-tools', $command->getDatabaseConnection($command_tester->getInput())->getKey());
   }
@@ -91,9 +88,8 @@ public function testPrefix() {
     ]);
     $this->assertEquals('extra', $command->getDatabaseConnection($command_tester->getInput())->tablePrefix());
 
-    $connection_info = Database::getConnectionInfo('default')['default'];
     $command_tester->execute([
-      '-db-url' => $connection_info['driver'] . '://' . $connection_info['username'] . ':' . $connection_info['password'] . '@' . $connection_info['host'] . '/' . $connection_info['database'],
+      '-db-url' => Database::getConnectionInfoAsUrl('default'),
       '--prefix' => 'extra2',
     ]);
     $this->assertEquals('extra2', $command->getDatabaseConnection($command_tester->getInput())->tablePrefix());
diff --git a/core/tests/Drupal/KernelTests/KernelTestBase.php b/core/tests/Drupal/KernelTests/KernelTestBase.php
index ca1a517..82e1036 100644
--- a/core/tests/Drupal/KernelTests/KernelTestBase.php
+++ b/core/tests/Drupal/KernelTests/KernelTestBase.php
@@ -462,7 +462,7 @@ protected function getDatabaseConnectionInfo() {
         // Replace the full table prefix definition to ensure that no table
         // prefixes of the test runner leak into the test.
         $connection_info[$target]['prefix'] = [
-          'default' => $value['prefix']['default'] . $this->databasePrefix,
+          'default' => $this->databasePrefix,
         ];
       }
     }
diff --git a/core/tests/Drupal/Tests/Core/Database/ConnectionTest.php b/core/tests/Drupal/Tests/Core/Database/ConnectionTest.php
index e455847..74e30ae 100644
--- a/core/tests/Drupal/Tests/Core/Database/ConnectionTest.php
+++ b/core/tests/Drupal/Tests/Core/Database/ConnectionTest.php
@@ -2,7 +2,7 @@
 
 namespace Drupal\Tests\Core\Database;
 
-use Drupal\Tests\Core\Database\Stub\StubConnection;
+use Drupal\Tests\Core\Database\Stub\Connection;
 use Drupal\Tests\UnitTestCase;
 
 /**
@@ -46,10 +46,10 @@ public function providerPrefixRoundTrip() {
    */
   public function testPrefixRoundTrip($expected, $prefix_info) {
     $mock_pdo = $this->getMock('Drupal\Tests\Core\Database\Stub\StubPDO');
-    $connection = new StubConnection($mock_pdo, []);
+    $connection = new Connection($mock_pdo, []);
 
     // setPrefix() is protected, so we make it accessible with reflection.
-    $reflection = new \ReflectionClass('Drupal\Tests\Core\Database\Stub\StubConnection');
+    $reflection = new \ReflectionClass('Drupal\Tests\Core\Database\Stub\Connection');
     $set_prefix = $reflection->getMethod('setPrefix');
     $set_prefix->setAccessible(TRUE);
 
@@ -95,7 +95,7 @@ public function providerTestPrefixTables() {
    */
   public function testPrefixTables($expected, $prefix_info, $query) {
     $mock_pdo = $this->getMock('Drupal\Tests\Core\Database\Stub\StubPDO');
-    $connection = new StubConnection($mock_pdo, ['prefix' => $prefix_info]);
+    $connection = new Connection($mock_pdo, ['prefix' => $prefix_info]);
     $this->assertEquals($expected, $connection->prefixTables($query));
   }
 
@@ -129,7 +129,7 @@ public function providerEscapeMethods() {
    */
   public function testEscapeMethods($expected, $name) {
     $mock_pdo = $this->getMock('Drupal\Tests\Core\Database\Stub\StubPDO');
-    $connection = new StubConnection($mock_pdo, []);
+    $connection = new Connection($mock_pdo, []);
     $this->assertEquals($expected, $connection->escapeDatabase($name));
     $this->assertEquals($expected, $connection->escapeTable($name));
     $this->assertEquals($expected, $connection->escapeField($name));
@@ -173,7 +173,7 @@ public function providerGetDriverClass() {
    */
   public function testGetDriverClass($expected, $namespace, $class) {
     $mock_pdo = $this->getMock('Drupal\Tests\Core\Database\Stub\StubPDO');
-    $connection = new StubConnection($mock_pdo, ['namespace' => $namespace]);
+    $connection = new Connection($mock_pdo, ['namespace' => $namespace]);
     // Set the driver using our stub class' public property.
     $this->assertEquals($expected, $connection->getDriverClass($class));
   }
@@ -204,7 +204,7 @@ public function providerSchema() {
    */
   public function testSchema($expected, $driver, $namespace) {
     $mock_pdo = $this->getMock('Drupal\Tests\Core\Database\Stub\StubPDO');
-    $connection = new StubConnection($mock_pdo, ['namespace' => $namespace]);
+    $connection = new Connection($mock_pdo, ['namespace' => $namespace]);
     $connection->driver = $driver;
     $this->assertInstanceOf($expected, $connection->schema());
   }
@@ -214,9 +214,9 @@ public function testSchema($expected, $driver, $namespace) {
    */
   public function testDestroy() {
     $mock_pdo = $this->getMock('Drupal\Tests\Core\Database\Stub\StubPDO');
-    // Mocking StubConnection gives us access to the $schema attribute.
+    // Mocking Connection gives us access to the $schema attribute.
     $connection = $this->getMock(
-      'Drupal\Tests\Core\Database\Stub\StubConnection',
+      'Drupal\Tests\Core\Database\Stub\Connection',
       NULL,
       [$mock_pdo, ['namespace' => 'Drupal\\Tests\\Core\\Database\\Stub\\Driver']]
     );
@@ -261,7 +261,7 @@ public function providerMakeComments() {
    */
   public function testMakeComments($expected, $comment_array) {
     $mock_pdo = $this->getMock('Drupal\Tests\Core\Database\Stub\StubPDO');
-    $connection = new StubConnection($mock_pdo, []);
+    $connection = new Connection($mock_pdo, []);
     $this->assertEquals($expected, $connection->makeComment($comment_array));
   }
 
@@ -288,10 +288,10 @@ public function providerFilterComments() {
    */
   public function testFilterComments($expected, $comment) {
     $mock_pdo = $this->getMock('Drupal\Tests\Core\Database\Stub\StubPDO');
-    $connection = new StubConnection($mock_pdo, []);
+    $connection = new Connection($mock_pdo, []);
 
     // filterComment() is protected, so we make it accessible with reflection.
-    $reflection = new \ReflectionClass('Drupal\Tests\Core\Database\Stub\StubConnection');
+    $reflection = new \ReflectionClass('Drupal\Tests\Core\Database\Stub\Connection');
     $filter_comment = $reflection->getMethod('filterComment');
     $filter_comment->setAccessible(TRUE);
 
diff --git a/core/tests/Drupal/Tests/Core/Database/Stub/Connection.php b/core/tests/Drupal/Tests/Core/Database/Stub/Connection.php
new file mode 100644
index 0000000..06500f7
--- /dev/null
+++ b/core/tests/Drupal/Tests/Core/Database/Stub/Connection.php
@@ -0,0 +1,72 @@
+<?php
+
+namespace Drupal\Tests\Core\Database\Stub;
+
+use Drupal\Core\Database\Connection as DatabaseConnection;
+use Drupal\Core\Database\StatementEmpty;
+
+/**
+ * A stub of the abstract Connection class for testing purposes.
+ *
+ * Includes minimal implementations of Connection's abstract methods.
+ */
+class Connection extends DatabaseConnection {
+
+  /**
+   * Public property so we can test driver loading mechanism.
+   *
+   * @var string
+   * @see driver().
+   */
+  public $driver = 'stub';
+
+  /**
+   * {@inheritdoc}
+   */
+  public function queryRange($query, $from, $count, array $args = [], array $options = []) {
+    return new StatementEmpty();
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function queryTemporary($query, array $args = [], array $options = []) {
+    return '';
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function driver() {
+    return $this->driver;
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function databaseType() {
+    return 'stub';
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function createDatabase($database) {
+    return;
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function mapConditionOperator($operator) {
+    return NULL;
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function nextId($existing_id = 0) {
+    return 0;
+  }
+
+}
diff --git a/core/tests/Drupal/Tests/Core/Database/Stub/StubConnection.php b/core/tests/Drupal/Tests/Core/Database/Stub/StubConnection.php
deleted file mode 100644
index 4692dff..0000000
--- a/core/tests/Drupal/Tests/Core/Database/Stub/StubConnection.php
+++ /dev/null
@@ -1,72 +0,0 @@
-<?php
-
-namespace Drupal\Tests\Core\Database\Stub;
-
-use Drupal\Core\Database\Connection;
-use Drupal\Core\Database\StatementEmpty;
-
-/**
- * A stub of the abstract Connection class for testing purposes.
- *
- * Includes minimal implementations of Connection's abstract methods.
- */
-class StubConnection extends Connection {
-
-  /**
-   * Public property so we can test driver loading mechanism.
-   *
-   * @var string
-   * @see driver().
-   */
-  public $driver = 'stub';
-
-  /**
-   * {@inheritdoc}
-   */
-  public function queryRange($query, $from, $count, array $args = [], array $options = []) {
-    return new StatementEmpty();
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function queryTemporary($query, array $args = [], array $options = []) {
-    return '';
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function driver() {
-    return $this->driver;
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function databaseType() {
-    return 'stub';
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function createDatabase($database) {
-    return;
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function mapConditionOperator($operator) {
-    return NULL;
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function nextId($existing_id = 0) {
-    return 0;
-  }
-
-}
diff --git a/core/tests/Drupal/Tests/Core/Database/UrlConversionTest.php b/core/tests/Drupal/Tests/Core/Database/UrlConversionTest.php
index c514b2e..8b764ef 100644
--- a/core/tests/Drupal/Tests/Core/Database/UrlConversionTest.php
+++ b/core/tests/Drupal/Tests/Core/Database/UrlConversionTest.php
@@ -37,25 +37,25 @@ public function providerConvertDbUrlToConnectionInfo() {
     $url1 = 'mysql://test_user:test_pass@test_host:3306/test_database';
     $database_array1 = [
       'driver' => 'mysql',
-      'username' => 'test_user',
-      'password' => 'test_pass',
       'host' => 'test_host',
       'database' => 'test_database',
-      'port' => '3306',
+      'prefix' => NULL,
+      'port' => 3306,
+      'username' => 'test_user',
+      'password' => 'test_pass',
+      'namespace' => 'Drupal\Core\Database\Driver\mysql',
     ];
     $root2 = '/var/www/d8';
     $url2 = 'sqlite://test_user:test_pass@test_host:3306/test_database';
     $database_array2 = [
       'driver' => 'sqlite',
-      'username' => 'test_user',
-      'password' => 'test_pass',
-      'host' => 'test_host',
       'database' => $root2 . '/test_database',
-      'port' => 3306,
+      'prefix' => NULL,
+      'namespace' => 'Drupal\Core\Database\Driver\sqlite',
     ];
     return [
       [$root1, $url1, $database_array1],
-      [$root2, $url2, $database_array2],
+      [$root2, $url2, $database_array2]
     ];
   }
 
@@ -122,7 +122,6 @@ public function providerGetConnectionInfoAsUrl() {
       'prefix' => '',
       'host' => 'test_host',
       'port' => '3306',
-      'namespace' => 'Drupal\\Core\\Database\\Driver\\mysql',
       'driver' => 'mysql',
     ];
     $expected_url1 = 'mysql://test_user:test_pass@test_host:3306/test_database';
diff --git a/core/tests/Drupal/Tests/Listeners/DeprecationListenerTrait.php b/core/tests/Drupal/Tests/Listeners/DeprecationListenerTrait.php
index 094fcf1..06ef6cc 100644
--- a/core/tests/Drupal/Tests/Listeners/DeprecationListenerTrait.php
+++ b/core/tests/Drupal/Tests/Listeners/DeprecationListenerTrait.php
@@ -122,6 +122,9 @@ public static function getSkippedDeprecations() {
       'drupal_set_message() is deprecated in Drupal 8.5.0 and will be removed before Drupal 9.0.0. Use \Drupal\Core\Messenger\MessengerInterface::addMessage() instead. See https://www.drupal.org/node/2774931',
       'drupal_get_message() is deprecated in Drupal 8.5.0 and will be removed before Drupal 9.0.0. Use \Drupal\Core\Messenger\MessengerInterface::all() or \Drupal\Core\Messenger\MessengerInterface::messagesByType() instead. See https://www.drupal.org/node/2774931',
       'Adding or retrieving messages prior to the container being initialized was deprecated in Drupal 8.5.0 and this functionality will be removed before Drupal 9.0.0. Please report this usage at https://www.drupal.org/node/2928994.',
+      'drupal_detect_database_types() is deprecated in Drupal 8.5.0, will be removed before Drupal 9.0.0. Use \Drupal\Core\Database\DatabaseDriverDiscovery::getInstallableDriversInstallerNames instead. See https://www.drupal.org/node/2896416.',
+      'drupal_get_database_types() is deprecated in Drupal 8.5.0, will be removed before Drupal 9.0.0. Use \Drupal\Core\Database\DatabaseDriverDiscovery::getInstallableDriversInstallers instead. See https://www.drupal.org/node/2896416.',
+      'db_installer_object() is deprecated in Drupal 8.5.0, will be removed before Drupal 9.0.0. Use \Drupal\Core\Database\DatabaseDriverDiscovery::getInstaller instead. See https://www.drupal.org/node/2896416.',
     ];
   }
 
