diff --git a/core/lib/Drupal/Core/Database/Driver/mysql/Connection.php b/core/lib/Drupal/Core/Database/Driver/mysql/Connection.php
index 164f68a947..d18607fc81 100644
--- a/core/lib/Drupal/Core/Database/Driver/mysql/Connection.php
+++ b/core/lib/Drupal/Core/Database/Driver/mysql/Connection.php
@@ -286,7 +286,7 @@ public function nextIdDelete() {
     // counter.
     try {
       $max_id = $this->query('SELECT MAX(value) FROM {sequences}')->fetchField();
-      // We know we are using MySQL here, no need for the slower db_delete().
+      // We know we are using MySQL here, no need for the slower \Drupal::database()->delete().
       $this->query('DELETE FROM {sequences} WHERE value < :value', [':value' => $max_id]);
     }
     // During testing, this function is called from shutdown with the
diff --git a/core/lib/Drupal/Core/Database/database.api.php b/core/lib/Drupal/Core/Database/database.api.php
index 45a561872a..e3b0815fdb 100644
--- a/core/lib/Drupal/Core/Database/database.api.php
+++ b/core/lib/Drupal/Core/Database/database.api.php
@@ -127,8 +127,9 @@
  * INSERT, UPDATE, and DELETE queries need special care in order to behave
  * consistently across databases; you should never use db_query() to run
  * an INSERT, UPDATE, or DELETE query. Instead, use functions db_insert(),
- * db_update(), and db_delete() to obtain a base query on your table, and then
- * add dynamic conditions (as illustrated in @ref sec_dynamic above).
+ * db_update(), and \Drupal::database()->delete() to obtain a base query on
+ * your table, and then add dynamic conditions (as illustrated in @ref
+ * sec_dynamic above).
  *
  * As a note, db_insert() and similar functions are wrappers on connection
  * object methods. In most classes, you should use dependency injection and the
diff --git a/core/lib/Drupal/Core/Entity/entity.api.php b/core/lib/Drupal/Core/Entity/entity.api.php
index 2b893fd7b3..971b1c6596 100644
--- a/core/lib/Drupal/Core/Entity/entity.api.php
+++ b/core/lib/Drupal/Core/Entity/entity.api.php
@@ -1292,7 +1292,7 @@ function hook_ENTITY_TYPE_predelete(Drupal\Core\Entity\EntityInterface $entity)
  */
 function hook_entity_delete(Drupal\Core\Entity\EntityInterface $entity) {
   // Delete the entity's entry from a fictional table of all entities.
-  db_delete('example_entity')
+  \Drupal::database()->delete('example_entity')
     ->condition('type', $entity->getEntityTypeId())
     ->condition('id', $entity->id())
     ->execute();
@@ -1311,7 +1311,7 @@ function hook_entity_delete(Drupal\Core\Entity\EntityInterface $entity) {
  */
 function hook_ENTITY_TYPE_delete(Drupal\Core\Entity\EntityInterface $entity) {
   // Delete the entity's entry from a fictional table of all entities.
-  db_delete('example_entity')
+  \Drupal::database()->delete('example_entity')
     ->condition('type', $entity->getEntityTypeId())
     ->condition('id', $entity->id())
     ->execute();
diff --git a/core/modules/aggregator/tests/src/Functional/ImportOpmlTest.php b/core/modules/aggregator/tests/src/Functional/ImportOpmlTest.php
index 2500b9ebb5..0221fb95fc 100644
--- a/core/modules/aggregator/tests/src/Functional/ImportOpmlTest.php
+++ b/core/modules/aggregator/tests/src/Functional/ImportOpmlTest.php
@@ -83,7 +83,7 @@ protected function submitImportForm() {
     $after = db_query('SELECT COUNT(*) FROM {aggregator_feed}')->fetchField();
     $this->assertEqual($before, $after, 'No feeds were added during the two last form submissions.');
 
-    db_delete('aggregator_feed')->execute();
+    \Drupal::database()->delete('aggregator_feed')->execute();
 
     $feeds[0] = $this->getFeedEditArray();
     $feeds[1] = $this->getFeedEditArray();
diff --git a/core/modules/dblog/dblog.module b/core/modules/dblog/dblog.module
index 700ceeaa6b..3ca04e35c3 100644
--- a/core/modules/dblog/dblog.module
+++ b/core/modules/dblog/dblog.module
@@ -75,7 +75,7 @@ function dblog_cron() {
 
     // Delete all table entries older than the nth row, if nth row was found.
     if ($min_row) {
-      db_delete('watchdog')
+      \Drupal::database()->delete('watchdog')
         ->condition('wid', $min_row, '<')
         ->execute();
     }
diff --git a/core/modules/dblog/tests/src/Functional/DbLogTest.php b/core/modules/dblog/tests/src/Functional/DbLogTest.php
index 5b82282d6a..83e5f99ad9 100644
--- a/core/modules/dblog/tests/src/Functional/DbLogTest.php
+++ b/core/modules/dblog/tests/src/Functional/DbLogTest.php
@@ -602,7 +602,7 @@ public function testFilter() {
     $this->drupalLogin($this->adminUser);
 
     // Clear the log to ensure that only generated entries will be found.
-    db_delete('watchdog')->execute();
+    \Drupal::database()->delete('watchdog')->execute();
 
     // Generate 9 random watchdog entries.
     $type_names = [];
diff --git a/core/modules/field/field.api.php b/core/modules/field/field.api.php
index 40b42e1dee..17b24647d8 100644
--- a/core/modules/field/field.api.php
+++ b/core/modules/field/field.api.php
@@ -394,7 +394,7 @@ function hook_field_info_max_weight($entity_type, $bundle, $context, $context_mo
  *   The field storage being purged.
  */
 function hook_field_purge_field_storage(\Drupal\field\Entity\FieldStorageConfig $field_storage) {
-  db_delete('my_module_field_storage_info')
+  \Drupal::database()->delete('my_module_field_storage_info')
     ->condition('uuid', $field_storage->uuid())
     ->execute();
 }
@@ -411,7 +411,7 @@ function hook_field_purge_field_storage(\Drupal\field\Entity\FieldStorageConfig
  *   The field being purged.
  */
 function hook_field_purge_field(\Drupal\field\Entity\FieldConfig $field) {
-  db_delete('my_module_field_info')
+  \Drupal::database()->delete('my_module_field_info')
     ->condition('id', $field->id())
     ->execute();
 }
diff --git a/core/modules/history/history.module b/core/modules/history/history.module
index f36121ef51..68108d15ce 100644
--- a/core/modules/history/history.module
+++ b/core/modules/history/history.module
@@ -124,7 +124,7 @@ function history_write($nid, $account = NULL) {
  * Implements hook_cron().
  */
 function history_cron() {
-  db_delete('history')
+  \Drupal::database()->delete('history')
     ->condition('timestamp', HISTORY_READ_LIMIT, '<')
     ->execute();
 }
@@ -151,7 +151,7 @@ function history_node_view_alter(array &$build, EntityInterface $node, EntityVie
  * Implements hook_ENTITY_TYPE_delete() for node entities.
  */
 function history_node_delete(EntityInterface $node) {
-  db_delete('history')
+  \Drupal::database()->delete('history')
     ->condition('nid', $node->id())
     ->execute();
 }
@@ -162,7 +162,7 @@ function history_node_delete(EntityInterface $node) {
 function history_user_cancel($edit, $account, $method) {
   switch ($method) {
     case 'user_cancel_reassign':
-      db_delete('history')
+      \Drupal::database()->delete('history')
         ->condition('uid', $account->id())
         ->execute();
       break;
@@ -173,7 +173,7 @@ function history_user_cancel($edit, $account, $method) {
  * Implements hook_ENTITY_TYPE_delete() for user entities.
  */
 function history_user_delete($account) {
-  db_delete('history')
+  \Drupal::database()->delete('history')
     ->condition('uid', $account->id())
     ->execute();
 }
diff --git a/core/modules/locale/locale.module b/core/modules/locale/locale.module
index 9e424484b8..18391771fd 100644
--- a/core/modules/locale/locale.module
+++ b/core/modules/locale/locale.module
@@ -864,7 +864,7 @@ function locale_translation_update_file_history($file) {
  *   Language code(s) to be deleted from the file history.
  */
 function locale_translation_file_history_delete($projects = [], $langcodes = []) {
-  $query = db_delete('locale_file');
+  $query = \Drupal::database()->delete('locale_file');
   if (!empty($projects)) {
     $query->condition('project', $projects, 'IN');
   }
diff --git a/core/modules/path/path.api.php b/core/modules/path/path.api.php
index df20b95e90..87138a77ac 100644
--- a/core/modules/path/path.api.php
+++ b/core/modules/path/path.api.php
@@ -20,7 +20,7 @@
  * @see \Drupal\Core\Path\PathInterface::save()
  */
 function hook_path_insert($path) {
-  db_insert('mytable')
+  \Drupal::database()->delete('mytable')
     ->fields([
       'alias' => $path['alias'],
       'pid' => $path['pid'],
diff --git a/core/modules/search/search.module b/core/modules/search/search.module
index 5be9206bc3..55c93d8ea9 100644
--- a/core/modules/search/search.module
+++ b/core/modules/search/search.module
@@ -140,8 +140,8 @@ function search_preprocess_block(&$variables) {
  *   omitted, all items matching $sid and $type are cleared.
  */
 function search_index_clear($type = NULL, $sid = NULL, $langcode = NULL) {
-  $query_index = db_delete('search_index');
-  $query_dataset = db_delete('search_dataset');
+  $query_index = \Drupal::database()->delete('search_index');
+  $query_dataset = \Drupal::database()->delete('search_dataset');
   if ($type) {
     $query_index->condition('type', $type);
     $query_dataset->condition('type', $type);
@@ -231,7 +231,7 @@ function search_update_totals() {
     $or->condition('word', $word->realword);
   }
   if (count($or) > 0) {
-    db_delete('search_total')
+    \Drupal::database()->delete('search_total')
       ->condition($or)
       ->execute();
   }
diff --git a/core/modules/shortcut/src/ShortcutSetStorage.php b/core/modules/shortcut/src/ShortcutSetStorage.php
index b136c2fb07..0d640590e0 100644
--- a/core/modules/shortcut/src/ShortcutSetStorage.php
+++ b/core/modules/shortcut/src/ShortcutSetStorage.php
@@ -9,6 +9,7 @@
 use Drupal\Core\Extension\ModuleHandlerInterface;
 use Drupal\Core\Language\LanguageManagerInterface;
 use Drupal\Core\Session\AccountInterface;
+use Drupal\Core\Database\Connection;
 use Symfony\Component\DependencyInjection\ContainerInterface;
 
 /**
@@ -23,6 +24,13 @@ class ShortcutSetStorage extends ConfigEntityStorage implements ShortcutSetStora
    */
   protected $moduleHandler;
 
+  /**
+   * The database connection.
+   *
+   * @var \Drupal\Core\Database\Connection
+   */
+  protected $database;
+
   /**
    * Constructs a ShortcutSetStorageController object.
    *
@@ -37,10 +45,11 @@ class ShortcutSetStorage extends ConfigEntityStorage implements ShortcutSetStora
    * @param \Drupal\Core\Language\LanguageManagerInterface $language_manager
    *   The language manager.
    */
-  public function __construct(EntityTypeInterface $entity_info, ConfigFactoryInterface $config_factory, UuidInterface $uuid_service, ModuleHandlerInterface $module_handler, LanguageManagerInterface $language_manager) {
+  public function __construct(EntityTypeInterface $entity_info, ConfigFactoryInterface $config_factory, UuidInterface $uuid_service, ModuleHandlerInterface $module_handler, LanguageManagerInterface $language_manager, Connection $database) {
     parent::__construct($entity_info, $config_factory, $uuid_service, $language_manager);
 
     $this->moduleHandler = $module_handler;
+    $this->database = $database;
   }
 
   /**
@@ -52,7 +61,8 @@ public static function createInstance(ContainerInterface $container, EntityTypeI
       $container->get('config.factory'),
       $container->get('uuid'),
       $container->get('module_handler'),
-      $container->get('language_manager')
+      $container->get('language_manager'),
+      $container->get('database')
     );
   }
 
@@ -62,7 +72,7 @@ public static function createInstance(ContainerInterface $container, EntityTypeI
   public function deleteAssignedShortcutSets(ShortcutSetInterface $entity) {
     // First, delete any user assignments for this set, so that each of these
     // users will go back to using whatever default set applies.
-    db_delete('shortcut_set_users')
+    $this->database->delete('shortcut_set_users')
       ->condition('set_name', $entity->id())
       ->execute();
   }
@@ -82,7 +92,7 @@ public function assignUser(ShortcutSetInterface $shortcut_set, $account) {
    * {@inheritdoc}
    */
   public function unassignUser($account) {
-    $deleted = db_delete('shortcut_set_users')
+    $deleted = $this->database->delete('shortcut_set_users')
       ->condition('uid', $account->id())
       ->execute();
     return (bool) $deleted;
diff --git a/core/modules/taxonomy/taxonomy.module b/core/modules/taxonomy/taxonomy.module
index be8532a2df..6b6c63dcc0 100644
--- a/core/modules/taxonomy/taxonomy.module
+++ b/core/modules/taxonomy/taxonomy.module
@@ -585,7 +585,7 @@ function taxonomy_node_predelete(EntityInterface $node) {
  */
 function taxonomy_delete_node_index(EntityInterface $node) {
   if (\Drupal::config('taxonomy.settings')->get('maintain_index_table')) {
-    db_delete('taxonomy_index')->condition('nid', $node->id())->execute();
+    \Drupal::database()->delete('taxonomy_index')->condition('nid', $node->id())->execute();
   }
 }
 
@@ -595,7 +595,7 @@ function taxonomy_delete_node_index(EntityInterface $node) {
 function taxonomy_taxonomy_term_delete(Term $term) {
   if (\Drupal::config('taxonomy.settings')->get('maintain_index_table')) {
     // Clean up the {taxonomy_index} table when terms are deleted.
-    db_delete('taxonomy_index')->condition('tid', $term->id())->execute();
+    \Drupal::database()->delete('taxonomy_index')->condition('tid', $term->id())->execute();
   }
 }
 
diff --git a/core/modules/tracker/tests/src/Functional/TrackerTest.php b/core/modules/tracker/tests/src/Functional/TrackerTest.php
index 1a77d95ac8..682ea30b9e 100644
--- a/core/modules/tracker/tests/src/Functional/TrackerTest.php
+++ b/core/modules/tracker/tests/src/Functional/TrackerTest.php
@@ -365,9 +365,9 @@ public function testTrackerCronIndexing() {
     \Drupal::state()->set('tracker.index_nid', 3);
 
     // Clear the current tracker tables and rebuild them.
-    db_delete('tracker_node')
+    \Drupal::database()->delete('tracker_node')
       ->execute();
-    db_delete('tracker_user')
+    \Drupal::database()->delete('tracker_user')
       ->execute();
     tracker_cron();
 
diff --git a/core/modules/tracker/tracker.module b/core/modules/tracker/tracker.module
index bf40dc1e8d..9e778f26ed 100644
--- a/core/modules/tracker/tracker.module
+++ b/core/modules/tracker/tracker.module
@@ -61,10 +61,10 @@ function tracker_cron() {
       $changed = _tracker_calculate_changed($node);
 
       // Remove existing data for this node.
-      db_delete('tracker_node')
+      \Drupal::database()->delete('tracker_node')
         ->condition('nid', $nid)
         ->execute();
-      db_delete('tracker_user')
+      \Drupal::database()->delete('tracker_user')
         ->condition('nid', $nid)
         ->execute();
 
@@ -199,10 +199,10 @@ function tracker_node_update(NodeInterface $node, $arg = 0) {
  * Deletes tracking information for a node.
  */
 function tracker_node_predelete(EntityInterface $node, $arg = 0) {
-  db_delete('tracker_node')
+  \Drupal::database()->delete('tracker_node')
     ->condition('nid', $node->id())
     ->execute();
-  db_delete('tracker_user')
+  \Drupal::database()->delete('tracker_user')
     ->condition('nid', $node->id())
     ->execute();
 }
@@ -343,7 +343,7 @@ function _tracker_remove($nid, $uid = NULL, $changed = NULL) {
 
     // If we haven't found a reason to keep the user's subscription, delete it.
     if (!$keep_subscription) {
-      db_delete('tracker_user')
+      \Drupal::database()->delete('tracker_user')
         ->condition('nid', $nid)
         ->condition('uid', $uid)
         ->execute();
@@ -381,10 +381,10 @@ function _tracker_remove($nid, $uid = NULL, $changed = NULL) {
   }
   else {
     // If the node doesn't exist, remove everything.
-    db_delete('tracker_node')
+    \Drupal::database()->delete('tracker_node')
       ->condition('nid', $nid)
       ->execute();
-    db_delete('tracker_user')
+    \Drupal::database()->delete('tracker_user')
       ->condition('nid', $nid)
       ->execute();
   }
diff --git a/core/tests/Drupal/KernelTests/Core/Config/Storage/DatabaseStorageTest.php b/core/tests/Drupal/KernelTests/Core/Config/Storage/DatabaseStorageTest.php
index 0aecc72b8f..8dee85c56b 100644
--- a/core/tests/Drupal/KernelTests/Core/Config/Storage/DatabaseStorageTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Config/Storage/DatabaseStorageTest.php
@@ -38,7 +38,7 @@ protected function update($name, $data) {
   }
 
   protected function delete($name) {
-    db_delete('config')->condition('name', $name)->execute();
+    \Drupal::database()->delete('config')->condition('name', $name)->execute();
   }
 
 }
diff --git a/core/tests/Drupal/KernelTests/Core/Database/DeleteTruncateTest.php b/core/tests/Drupal/KernelTests/Core/Database/DeleteTruncateTest.php
index 8d736613c6..c83bb88e09 100644
--- a/core/tests/Drupal/KernelTests/Core/Database/DeleteTruncateTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Database/DeleteTruncateTest.php
@@ -27,7 +27,7 @@ public function testSubselectDelete() {
     $subquery = db_select('test', 't')
       ->fields('t', ['id'])
       ->condition('t.id', [$pid_to_delete], 'IN');
-    $delete = db_delete('test_task')
+    $delete = \Drupal::database()->delete('test_task')
       ->condition('task', 'sleep')
       ->condition('pid', $subquery, 'IN');
 
@@ -44,7 +44,7 @@ public function testSubselectDelete() {
   public function testSimpleDelete() {
     $num_records_before = db_query('SELECT COUNT(*) FROM {test}')->fetchField();
 
-    $num_deleted = db_delete('test')
+    $num_deleted = \Drupal::database()->delete('test')
       ->condition('id', 1)
       ->execute();
     $this->assertIdentical($num_deleted, 1, 'Deleted 1 record.');
@@ -72,7 +72,7 @@ public function testTruncate() {
   public function testSpecialColumnDelete() {
     $num_records_before = db_query('SELECT COUNT(*) FROM {test_special_columns}')->fetchField();
 
-    $num_deleted = db_delete('test_special_columns')
+    $num_deleted = \Drupal::database()->delete('test_special_columns')
       ->condition('id', 1)
       ->execute();
     $this->assertIdentical($num_deleted, 1, 'Deleted 1 special column record.');
