diff --git a/core/includes/install.core.inc b/core/includes/install.core.inc
index 97b409b..d7d561c 100644
--- a/core/includes/install.core.inc
+++ b/core/includes/install.core.inc
@@ -1156,14 +1156,14 @@ function install_database_errors($database, $settings_file) {
   $errors = [];
 
   // Check database type.
-  $database_types = drupal_get_database_types();
+  $installable_drivers = \Drupal::service('database.driver.discovery')->getInstallableDriversInstallers();
   $driver = $database['driver'];
-  if (!isset($database_types[$driver])) {
+  if (!isset($installable_drivers[$driver])) {
     $errors['driver'] = t("In your %settings_file file you have configured @drupal to use a %driver server, however your PHP installation currently does not support this database type.", ['%settings_file' => $settings_file, '@drupal' => drupal_install_profile_distribution_name(), '%driver' => $driver]);
   }
   else {
     // Run driver specific validation
-    $errors += $database_types[$driver]->validateDatabaseSettings($database);
+    $errors += $installable_drivers[$driver]->validateDatabaseSettings($database);
     if (!empty($errors)) {
       // No point to try further.
       return $errors;
@@ -1172,7 +1172,7 @@ function install_database_errors($database, $settings_file) {
     // calling function.
     Database::addConnectionInfo('default', 'default', $database);
 
-    $errors = db_installer_object($driver)->runTasks();
+    $errors = $installable_drivers[$driver]->runTasks();
   }
   return $errors;
 }
diff --git a/core/includes/install.inc b/core/includes/install.inc
index dba5ce0..165eaa5 100644
--- a/core/includes/install.inc
+++ b/core/includes/install.inc
@@ -149,6 +149,7 @@ function drupal_install_profile_distribution_version() {
  * @see https://www.drupal.org/node/2896416
  */
 function drupal_detect_database_types() {
+  @trigger_error('drupal_detect_database_types() is deprecated in Drupal 8.5.0, will be removed before Drupal 9.0.0. Use \Drupal::service(\'database.driver.discovery\')->getInstallableDriversInstallerNames instead. See https://www.drupal.org/node/2896416.', E_USER_DEPRECATED);
   return \Drupal::service('database.driver.discovery')->getInstallableDriversInstallerNames();
 }
 
@@ -165,6 +166,7 @@ function drupal_detect_database_types() {
  * @see https://www.drupal.org/node/2896416
  */
 function drupal_get_database_types() {
+  @trigger_error('drupal_get_database_types() is deprecated in Drupal 8.5.0, will be removed before Drupal 9.0.0. Use \Drupal::service(\'database.driver.discovery\')->getInstallableDriversInstaller instead. See https://www.drupal.org/node/2896416.', E_USER_DEPRECATED);
   return \Drupal::service('database.driver.discovery')->getInstallableDriversInstallers();
 }
 
@@ -1092,5 +1094,6 @@ function install_profile_info($profile, $langcode = 'en') {
  * @see https://www.drupal.org/node/2896416
  */
 function db_installer_object($driver) {
+  @trigger_error('db_installer_object() is deprecated in Drupal 8.5.0, will be removed before Drupal 9.0.0. Use \Drupal::service(\'database.driver.discovery\')->getInstaller instead. See https://www.drupal.org/node/2896416.', E_USER_DEPRECATED);
   return \Drupal::service('database.driver.discovery')->getInstaller($driver);
 }
diff --git a/core/lib/Drupal/Core/Installer/Form/SiteSettingsForm.php b/core/lib/Drupal/Core/Installer/Form/SiteSettingsForm.php
index 300def9..c73a84a 100644
--- a/core/lib/Drupal/Core/Installer/Form/SiteSettingsForm.php
+++ b/core/lib/Drupal/Core/Installer/Form/SiteSettingsForm.php
@@ -66,8 +66,8 @@ public function buildForm(array $form, FormStateInterface $form_state) {
 
     $form['#title'] = $this->t('Database configuration');
 
-    $drivers = drupal_get_database_types();
-    $drivers_keys = array_keys($drivers);
+    $installable_drivers = \Drupal::service('database.driver.discovery')->getInstallableDriversInstallers();
+    $installable_drivers_keys = array_keys($installable_drivers);
 
     // Unless there is input for this form (for a non-interactive installation,
     // input originates from the $settings array passed into install_drupal()),
@@ -98,7 +98,7 @@ public function buildForm(array $form, FormStateInterface $form_state) {
     // as default value, so that its settings form is made visible via #states
     // when JavaScript is enabled (see below).
     else {
-      $default_driver = current($drivers_keys);
+      $default_driver = current($installable_drivers_keys);
       $default_options = [];
     }
 
@@ -108,12 +108,12 @@ public function buildForm(array $form, FormStateInterface $form_state) {
       '#required' => TRUE,
       '#default_value' => $default_driver,
     ];
-    if (count($drivers) == 1) {
+    if (count($installable_drivers) == 1) {
       $form['driver']['#disabled'] = TRUE;
     }
 
     // Add driver specific configuration options.
-    foreach ($drivers as $key => $driver) {
+    foreach ($installable_drivers as $key => $driver) {
       $form['driver']['#options'][$key] = $driver->name();
 
       $form['settings'][$key] = $driver->getFormOptions($default_options);
@@ -152,11 +152,8 @@ public function buildForm(array $form, FormStateInterface $form_state) {
   public function validateForm(array &$form, FormStateInterface $form_state) {
     $driver = $form_state->getValue('driver');
     $database = $form_state->getValue($driver);
-    $drivers = drupal_get_database_types();
-    $reflection = new \ReflectionClass($drivers[$driver]);
-    $install_namespace = $reflection->getNamespaceName();
-    // Cut the trailing \Install from namespace.
-    $database['namespace'] = substr($install_namespace, 0, strrpos($install_namespace, '\\'));
+    $discovered_drivers = \Drupal::service('database.driver.discovery')->discoverDatabaseDrivers();
+    $database['namespace'] = $discovered_drivers[$driver]['namespace'];
     $database['driver'] = $driver;
 
     $form_state->set('database', $database);
diff --git a/core/lib/Drupal/Core/Test/FunctionalTestSetupTrait.php b/core/lib/Drupal/Core/Test/FunctionalTestSetupTrait.php
index 3165815..164247b 100644
--- a/core/lib/Drupal/Core/Test/FunctionalTestSetupTrait.php
+++ b/core/lib/Drupal/Core/Test/FunctionalTestSetupTrait.php
@@ -656,7 +656,7 @@ protected function prepareEnvironment() {
   /**
    * Returns all supported database driver installer objects.
    *
-   * This wraps drupal_get_database_types() for use without a current container.
+   * This swaps the original container for use without a current container.
    *
    * @return \Drupal\Core\Database\Install\Tasks[]
    *   An array of available database driver installer objects.
@@ -665,7 +665,7 @@ protected function getDatabaseTypes() {
     if ($this->originalContainer) {
       \Drupal::setContainer($this->originalContainer);
     }
-    $database_types = drupal_get_database_types();
+    $database_types = \Drupal::service('database.driver.discovery')->getInstallableDriversInstallers();
     if ($this->originalContainer) {
       \Drupal::unsetContainer();
     }
diff --git a/core/modules/migrate_drupal_ui/src/Form/MigrateUpgradeForm.php b/core/modules/migrate_drupal_ui/src/Form/MigrateUpgradeForm.php
index 898a8a5..60f1103 100644
--- a/core/modules/migrate_drupal_ui/src/Form/MigrateUpgradeForm.php
+++ b/core/modules/migrate_drupal_ui/src/Form/MigrateUpgradeForm.php
@@ -2,6 +2,7 @@
 
 namespace Drupal\migrate_drupal_ui\Form;
 
+use Drupal\Core\Database\DatabaseDriverDiscovery;
 use Drupal\Core\Datetime\DateFormatterInterface;
 use Drupal\Core\Extension\ModuleHandlerInterface;
 use Drupal\Core\Form\ConfirmFormBase;
@@ -69,6 +70,13 @@ class MigrateUpgradeForm extends ConfirmFormBase {
   protected $moduleHandler;
 
   /**
+   * The database discovery service.
+   *
+   * @var \Drupal\Core\Database\DatabaseDriverDiscovery
+   */
+  protected $databaseDriverDiscovery;
+
+  /**
    * Constructs the MigrateUpgradeForm.
    *
    * @param \Drupal\Core\State\StateInterface $state
@@ -83,14 +91,17 @@ class MigrateUpgradeForm extends ConfirmFormBase {
    *   The field plugin manager.
    * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler
    *   The module handler.
+   * @param \Drupal\Core\Database\DatabaseDriverDiscovery $database_driver_discovery
+   *   The database discovery service.
    */
-  public function __construct(StateInterface $state, DateFormatterInterface $date_formatter, RendererInterface $renderer, MigrationPluginManagerInterface $plugin_manager, MigrateFieldPluginManagerInterface $field_plugin_manager, ModuleHandlerInterface $module_handler) {
+  public function __construct(StateInterface $state, DateFormatterInterface $date_formatter, RendererInterface $renderer, MigrationPluginManagerInterface $plugin_manager, MigrateFieldPluginManagerInterface $field_plugin_manager, ModuleHandlerInterface $module_handler, DatabaseDriverDiscovery $database_driver_discovery) {
     $this->state = $state;
     $this->dateFormatter = $date_formatter;
     $this->renderer = $renderer;
     $this->pluginManager = $plugin_manager;
     $this->fieldPluginManager = $field_plugin_manager;
     $this->moduleHandler = $module_handler;
+    $this->databaseDriverDiscovery = $database_driver_discovery;
   }
 
   /**
@@ -103,7 +114,8 @@ public static function create(ContainerInterface $container) {
       $container->get('renderer'),
       $container->get('plugin.manager.migration'),
       $container->get('plugin.manager.migrate.field'),
-      $container->get('module_handler')
+      $container->get('module_handler'),
+      $container->get('database.driver.discovery')
     );
   }
 
@@ -381,21 +393,16 @@ public function buildCredentialForm(array $form, FormStateInterface $form_state)
    */
   public function validateCredentialForm(array &$form, FormStateInterface $form_state) {
 
-    // Retrieve the database driver from the form, use reflection to get the
-    // namespace, and then construct a valid database array the same as in
-    // settings.php.
+    // Retrieve the database driver from the form and construct a valid database
+    // array the same as in settings.php.
+    $discovered_drivers = \Drupal::service('database.driver.discovery')->discoverDatabaseDrivers();
     $driver = $form_state->getValue('driver');
-    $drivers = $this->getDatabaseTypes();
-    $reflection = new \ReflectionClass($drivers[$driver]);
-    $install_namespace = $reflection->getNamespaceName();
-
     $database = $form_state->getValue($driver);
-    // Cut the trailing \Install from namespace.
-    $database['namespace'] = substr($install_namespace, 0, strrpos($install_namespace, '\\'));
+    $database['namespace'] = $discovered_drivers[$driver]['namespace'];
     $database['driver'] = $driver;
 
     // Validate the driver settings and just end here if we have any issues.
-    if ($errors = $drivers[$driver]->validateDatabaseSettings($database)) {
+    if ($errors = $discovered_drivers[$driver]['installer']->validateDatabaseSettings($database)) {
       foreach ($errors as $name => $message) {
         $form_state->setErrorByName($name, $message);
       }
@@ -842,9 +849,10 @@ public function submitConfirmForm(array &$form, FormStateInterface $form_state)
    *   An array of available database driver installer objects.
    */
   protected function getDatabaseTypes() {
-    // Make sure the install API is available.
+    // Make sure the install API is available. Even if the driver discovery is
+    // a service, still there may be calls to procedural functions.
     include_once DRUPAL_ROOT . '/core/includes/install.inc';
-    return drupal_get_database_types();
+    return $this->databaseDriverDiscovery->getInstallableDriversInstallers();
   }
 
   /**
diff --git a/core/modules/migrate_drupal_ui/src/Tests/MigrateUpgradeTestBase.php b/core/modules/migrate_drupal_ui/src/Tests/MigrateUpgradeTestBase.php
index 0e01c23..2a435c9 100644
--- a/core/modules/migrate_drupal_ui/src/Tests/MigrateUpgradeTestBase.php
+++ b/core/modules/migrate_drupal_ui/src/Tests/MigrateUpgradeTestBase.php
@@ -132,7 +132,7 @@ public function testMigrateUpgrade() {
 
     // Use the driver connection form to get the correct options out of the
     // database settings. This supports all of the databases we test against.
-    $drivers = drupal_get_database_types();
+    $drivers = \Drupal::service('database.driver.discovery')->getInstallableDriversInstallers();
     $form = $drivers[$driver]->getFormOptions($connection_options);
     $connection_options = array_intersect_key($connection_options, $form + $form['advanced_options']);
     $edit = [
diff --git a/core/modules/migrate_drupal_ui/tests/src/Functional/MigrateUpgradeTestBase.php b/core/modules/migrate_drupal_ui/tests/src/Functional/MigrateUpgradeTestBase.php
index 98c05aa..f15a0b3 100644
--- a/core/modules/migrate_drupal_ui/tests/src/Functional/MigrateUpgradeTestBase.php
+++ b/core/modules/migrate_drupal_ui/tests/src/Functional/MigrateUpgradeTestBase.php
@@ -134,7 +134,7 @@ public function testMigrateUpgrade() {
 
     // Use the driver connection form to get the correct options out of the
     // database settings. This supports all of the databases we test against.
-    $drivers = drupal_get_database_types();
+    $drivers = \Drupal::service('database.driver.discovery')->getInstallableDriversInstallers();
     $form = $drivers[$driver]->getFormOptions($connection_options);
     $connection_options = array_intersect_key($connection_options, $form + $form['advanced_options']);
     $version = $this->getLegacyDrupalVersion($this->sourceDatabase);
diff --git a/core/modules/simpletest/src/KernelTestBase.php b/core/modules/simpletest/src/KernelTestBase.php
index 255adcc..d4e3a24 100644
--- a/core/modules/simpletest/src/KernelTestBase.php
+++ b/core/modules/simpletest/src/KernelTestBase.php
@@ -214,7 +214,7 @@ protected function setUp() {
     // Ensure database install tasks have been run.
     require_once __DIR__ . '/../../../includes/install.inc';
     $connection = Database::getConnection();
-    $errors = db_installer_object($connection->driver())->runTasks();
+    $errors = \Drupal::service('database.driver.discovery')->getInstaller($connection->driver())->runTasks();
     if (!empty($errors)) {
       $this->fail('Failed to run installer database tasks: ' . implode(', ', $errors));
     }
diff --git a/core/modules/system/src/Tests/Update/UpdatePathTestBase.php b/core/modules/system/src/Tests/Update/UpdatePathTestBase.php
index b5529c5..6bbc7a3 100644
--- a/core/modules/system/src/Tests/Update/UpdatePathTestBase.php
+++ b/core/modules/system/src/Tests/Update/UpdatePathTestBase.php
@@ -332,7 +332,7 @@ protected function runDbTasks() {
 
     require_once __DIR__ . '/../../../../../includes/install.inc';
     $connection = Database::getConnection();
-    $errors = db_installer_object($connection->driver())->runTasks();
+    $errors = \Drupal::service('database.driver.discovery')->getInstaller($connection->driver())->runTasks();
     if (!empty($errors)) {
       $this->fail('Failed to run installer database tasks: ' . implode(', ', $errors));
     }
diff --git a/core/modules/system/system.install b/core/modules/system/system.install
index ef6f124..1e2677c 100644
--- a/core/modules/system/system.install
+++ b/core/modules/system/system.install
@@ -329,8 +329,7 @@ function system_requirements($phase) {
     }
     else {
       // Make sure at least one supported database driver exists.
-      $drivers = drupal_detect_database_types();
-      if (empty($drivers)) {
+      if (empty(\Drupal::service('database.driver.discovery')->getInstallableDriversInstallers())) {
         $database_ok = FALSE;
         $pdo_message = t('Your web server does not appear to support any common PDO database extensions. Check with your hosting provider to see if they support PDO (PHP Data Objects) and offer any databases that <a href=":drupal-databases">Drupal supports</a>.', [
           ':drupal-databases' => 'https://www.drupal.org/requirements/database',
diff --git a/core/tests/Drupal/FunctionalTests/Update/UpdatePathTestBase.php b/core/tests/Drupal/FunctionalTests/Update/UpdatePathTestBase.php
index c59d096..80aa645 100644
--- a/core/tests/Drupal/FunctionalTests/Update/UpdatePathTestBase.php
+++ b/core/tests/Drupal/FunctionalTests/Update/UpdatePathTestBase.php
@@ -412,7 +412,7 @@ protected function runDbTasks() {
 
     require_once __DIR__ . '/../../../../includes/install.inc';
     $connection = Database::getConnection();
-    $errors = db_installer_object($connection->driver())->runTasks();
+    $errors = \Drupal::service('database.driver.discovery')->getInstaller($connection->driver())->runTasks();
     if (!empty($errors)) {
       $this->fail('Failed to run installer database tasks: ' . implode(', ', $errors));
     }
diff --git a/core/tests/Drupal/KernelTests/KernelTestBase.php b/core/tests/Drupal/KernelTests/KernelTestBase.php
index a051c14..7883c3a 100644
--- a/core/tests/Drupal/KernelTests/KernelTestBase.php
+++ b/core/tests/Drupal/KernelTests/KernelTestBase.php
@@ -378,7 +378,7 @@ private function bootKernel() {
     // Ensure database tasks have been run.
     require_once __DIR__ . '/../../../includes/install.inc';
     $connection = Database::getConnection();
-    $errors = db_installer_object($connection->driver())->runTasks();
+    $errors = \Drupal::service('database.driver.discovery')->getInstaller($connection->driver())->runTasks();
     if (!empty($errors)) {
       $this->fail('Failed to run installer database tasks: ' . implode(', ', $errors));
     }
