diff --git a/core/lib/Drupal/Core/Command/DbCommandBase.php b/core/lib/Drupal/Core/Command/DbCommandBase.php
new file mode 100644
index 0000000..18cff45
--- /dev/null
+++ b/core/lib/Drupal/Core/Command/DbCommandBase.php
@@ -0,0 +1,64 @@
+<?php
+
+/**
+ * @file
+ * Contains \Drupal\Core\Command\DbCommandBase
+ */
+
+namespace Drupal\Core\Command;
+
+use Drupal\Core\Database\Database;
+use Symfony\Component\Console\Command\Command;
+use Symfony\Component\Console\Input\InputInterface;
+use Symfony\Component\Console\Input\InputOption;
+
+/**
+ * Base command that abstracts handling of database connection arguments.
+ */
+class DbCommandBase extends Command {
+
+  protected function configure() {
+    $this->addOption('database', NULL, InputOption::VALUE_OPTIONAL, 'The database connection name to use.', 'default')
+      ->addOption('database-url', 'db-url', InputOption::VALUE_OPTIONAL, 'A database url to parse and use as the database connection.')
+      ->addOption('prefix', NULL, InputOption::VALUE_OPTIONAL, 'Override or set the table prefix used in the database connection.');
+  }
+
+  /**
+   * Parse input options decide on a database.
+   *
+   * @todo this could probably be refactored to use global connections.
+   *
+   * @param \Symfony\Component\Console\Input\InputInterface $input
+   *   Input object.
+   * @return \Drupal\Core\Database\Connection
+   */
+  protected function getDatabaseConnection(InputInterface $input) {
+
+    // Load connection from a url.
+    if ($input->getOption('database-url')) {
+      // ensure database connection isn't set.
+      if (Database::getConnectionInfo('db-tools')) {
+        throw new \RuntimeException('Database "db-tools" is already defined. Can not define database provided.');
+      }
+      $info = Database::parseConnectionInfo($input->getOption('database-url'));
+      Database::addConnectionInfo('db-tools', 'default', $info);
+      $key = 'db-tools';
+    }
+    else {
+      $key = $input->getOption('database');
+    }
+
+    // If they supplied a prefix, replace it in the connection information.
+    $prefix = $input->getOption('prefix');
+    if ($prefix) {
+      $info = Database::getConnectionInfo($key)['default'];
+      $info['prefix']['default'] = $prefix;
+
+      Database::removeConnection($key);
+      Database::addConnectionInfo($key, 'default', $info);
+    }
+
+    return Database::getConnection($key);
+  }
+
+}
diff --git a/core/lib/Drupal/Core/Command/DbDumpApplication.php b/core/lib/Drupal/Core/Command/DbDumpApplication.php
index 080e20f..bb5b715 100644
--- a/core/lib/Drupal/Core/Command/DbDumpApplication.php
+++ b/core/lib/Drupal/Core/Command/DbDumpApplication.php
@@ -7,8 +7,6 @@
 
 namespace Drupal\Core\Command;
 
-use Drupal\Core\Database\Connection;
-use Drupal\Core\Extension\ModuleHandlerInterface;
 use Symfony\Component\Console\Application;
 use Symfony\Component\Console\Input\InputInterface;
 
@@ -18,34 +16,6 @@
 class DbDumpApplication extends Application {
 
   /**
-   * The database connection.
-   *
-   * @var \Drupal\Core\Database\Connection
-   */
-  protected $connection;
-
-  /**
-   * The module handler.
-   *
-   * @var \Drupal\Core\Extension\ModuleHandlerInterface
-   */
-  protected $moduleHandler;
-
-  /**
-   * Construct the application.
-   *
-   * @param \Drupal\Core\Database\Connection $connection
-   *   The database connection.
-   * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler
-   *   The module handler.
-   */
-  function __construct(Connection $connection, ModuleHandlerInterface $module_handler) {
-    $this->connection = $connection;
-    $this->moduleHandler = $module_handler;
-    parent::__construct();
-  }
-
-  /**
    * {@inheritdoc}
    */
   protected function getCommandName(InputInterface $input) {
@@ -58,7 +28,7 @@ protected function getCommandName(InputInterface $input) {
   protected function getDefaultCommands() {
     // Even though this is a single command, keep the HelpCommand (--help).
     $default_commands = parent::getDefaultCommands();
-    $default_commands[] = new DbDumpCommand($this->connection, $this->moduleHandler);
+    $default_commands[] = new DbDumpCommand();
     return $default_commands;
   }
 
diff --git a/core/lib/Drupal/Core/Command/DbDumpCommand.php b/core/lib/Drupal/Core/Command/DbDumpCommand.php
index 9c889be..198de8e 100644
--- a/core/lib/Drupal/Core/Command/DbDumpCommand.php
+++ b/core/lib/Drupal/Core/Command/DbDumpCommand.php
@@ -9,8 +9,6 @@
 
 use Drupal\Component\Utility\Variable;
 use Drupal\Core\Database\Connection;
-use Drupal\Core\Extension\ModuleHandlerInterface;
-use Symfony\Component\Console\Command\Command;
 use Symfony\Component\Console\Input\InputInterface;
 use Symfony\Component\Console\Output\OutputInterface;
 
@@ -30,21 +28,7 @@
  *
  * @see \Drupal\Core\Command\DbDumpApplication
  */
-class DbDumpCommand extends Command {
-
-  /**
-   * The database connection.
-   *
-   * @var \Drupal\Core\Database\Connection $connection
-   */
-  protected $connection;
-
-  /**
-   * The module handler.
-   *
-   * @var \Drupal\Core\Extension\ModuleHandlerInterface
-   */
-  protected $moduleHandler;
+class DbDumpCommand extends DbCommandBase {
 
   /**
    * An array of table patterns to exclude completely.
@@ -63,73 +47,59 @@ class DbDumpCommand extends Command {
   protected $schemaOnly = ['cache.*', 'sessions', 'watchdog'];
 
   /**
-   * Construct the database dump command.
-   *
-   * @param \Drupal\Core\Database\Connection $connection
-   *   The database connection to use.
-   * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler
-   *   The module handler to use.
-   */
-  function __construct(Connection $connection, ModuleHandlerInterface $module_handler) {
-    // Check this is MySQL.
-    if ($connection->databaseType() !== 'mysql') {
-      throw new \RuntimeException('This script can only be used with MySQL database backends.');
-    }
-
-    $this->connection = $connection;
-    $this->moduleHandler = $module_handler;
-    parent::__construct();
-  }
-
-  /**
    * {@inheritdoc}
    */
   protected function configure() {
     $this->setName('dump-database-d8-mysql')
       ->setDescription('Dump the current database to a generation script');
+    parent::configure();
   }
 
   /**
    * {@inheritdoc}
    */
   protected function execute(InputInterface $input, OutputInterface $output) {
+    $connection = $this->getDatabaseConnection($input);
+
     // If not explicitly set, disable ANSI which will break generated php.
     if ($input->hasParameterOption(['--ansi']) !== TRUE) {
       $output->setDecorated(FALSE);
     }
 
-    $output->writeln($this->generateScript());
+    $output->writeln($this->generateScript($connection));
   }
 
   /**
    * Generates the database script.
    *
-   * @return string
+   * @param \Drupal\Core\Database\Connection $connection
+   *   The database connection to use.
+   * @return string The PHP script.
    *   The PHP script.
    */
-  protected function generateScript() {
+  protected function generateScript(Connection $connection) {
     $tables = '';
-    foreach ($this->getTables() as $table) {
-      $schema = $this->getTableSchema($table);
-      $data = $this->getTableData($table);
+    foreach ($this->getTables($connection) as $table) {
+      $schema = $this->getTableSchema($connection, $table);
+      $data = $this->getTableData($connection, $table);
       $tables .= $this->getTableScript($table, $schema, $data);
     }
     $script = $this->getTemplate();
     // Substitute in the tables.
     $script = str_replace('{{TABLES}}', trim($tables), $script);
-    // Modules.
-    $script = str_replace('{{MODULES}}', $this->getModulesScript(), $script);
     return trim($script);
   }
 
   /**
    * Returns a list of tables, not including those set to be excluded.
    *
-   * @return array
+   * @param \Drupal\Core\Database\Connection $connection
+   *   The database connection to use.
+   * @return array An array of table names.
    *   An array of table names.
    */
-  protected function getTables() {
-    $tables = array_values($this->connection->schema()->findTables('%'));
+  protected function getTables(Connection $connection) {
+    $tables = array_values($connection->schema()->findTables('%'));
 
     foreach ($tables as $key => $table) {
       // Remove any explicitly excluded tables.
@@ -146,6 +116,8 @@ protected function getTables() {
   /**
    * Returns a schema array for a given table.
    *
+   * @param \Drupal\Core\Database\Connection $connection
+   *   The database connection to use.
    * @param string $table
    *   The table name.
    *
@@ -154,14 +126,19 @@ protected function getTables() {
    *
    * @todo This implementation is hard-coded for MySQL.
    */
-  protected function getTableSchema($table) {
-    $query = $this->connection->query("SHOW FULL COLUMNS FROM {" . $table . "}");
+  protected function getTableSchema(Connection $connection, $table) {
+    // Check this is MySQL.
+    if ($connection->databaseType() !== 'mysql') {
+      throw new \RuntimeException('This script can only be used with MySQL database backends.');
+    }
+
+    $query = $connection->query("SHOW FULL COLUMNS FROM {" . $table . "}");
     $definition = [];
     while (($row = $query->fetchAssoc()) !== FALSE) {
       $name = $row['Field'];
       // Parse out the field type and meta information.
       preg_match('@([a-z]+)(?:\((\d+)(?:,(\d+))?\))?\s*(unsigned)?@', $row['Type'], $matches);
-      $type  = $this->fieldTypeMap($matches[1]);
+      $type  = $this->fieldTypeMap($connection, $matches[1]);
       if ($row['Extra'] === 'auto_increment') {
         // If this is an auto increment, then the type is 'serial'.
         $type = 'serial';
@@ -170,7 +147,7 @@ protected function getTableSchema($table) {
         'type' => $type,
         'not null' => $row['Null'] === 'NO',
       ];
-      if ($size = $this->fieldSizeMap($matches[1])) {
+      if ($size = $this->fieldSizeMap($connection, $matches[1])) {
         $definition['fields'][$name]['size'] = $size;
       }
       if (isset($matches[2]) && $type === 'numeric') {
@@ -216,10 +193,10 @@ protected function getTableSchema($table) {
     }
 
     // Set primary key, unique keys, and indexes.
-    $this->getTableIndexes($table, $definition);
+    $this->getTableIndexes($connection, $table, $definition);
 
     // Set table collation.
-    $this->getTableCollation($table, $definition);
+    $this->getTableCollation($connection, $table, $definition);
 
     return $definition;
   }
@@ -227,15 +204,17 @@ protected function getTableSchema($table) {
   /**
    * Adds primary key, unique keys, and index information to the schema.
    *
+   * @param \Drupal\Core\Database\Connection $connection
+   *   The database connection to use.
    * @param string $table
    *   The table to find indexes for.
    * @param array &$definition
    *   The schema definition to modify.
    */
-  protected function getTableIndexes($table, &$definition) {
+  protected function getTableIndexes(Connection $connection, $table, &$definition) {
     // Note, this query doesn't support ordering, so that is worked around
     // below by keying the array on Seq_in_index.
-    $query = $this->connection->query("SHOW INDEX FROM {" . $table . "}");
+    $query = $connection->query("SHOW INDEX FROM {" . $table . "}");
     while (($row = $query->fetchAssoc()) !== FALSE) {
       $index_name = $row['Key_name'];
       $column = $row['Column_name'];
@@ -262,13 +241,15 @@ protected function getTableIndexes($table, &$definition) {
   /**
    * Set the table collation.
    *
+   * @param \Drupal\Core\Database\Connection $connection
+   *   The database connection to use.
    * @param string $table
    *   The table to find indexes for.
    * @param array &$definition
    *   The schema definition to modify.
    */
-  protected function getTableCollation($table, &$definition) {
-    $query = $this->connection->query("SHOW TABLE STATUS LIKE '{" . $table . "}'");
+  protected function getTableCollation(Connection $connection, $table, &$definition) {
+    $query = $connection->query("SHOW TABLE STATUS LIKE '{" . $table . "}'");
     $data = $query->fetchAssoc();
 
     // Set `mysql_character_set`. This will be ignored by other backends.
@@ -280,21 +261,23 @@ protected function getTableCollation($table, &$definition) {
    *
    * If a table is set to be schema only, and empty array is returned.
    *
+   * @param \Drupal\Core\Database\Connection $connection
+   *   The database connection to use.
    * @param string $table
    *   The table to query.
    *
    * @return array
    *   The data from the table as an array.
    */
-  protected function getTableData($table) {
+  protected function getTableData(Connection $connection, $table) {
     // Check for schema only.
     foreach ($this->schemaOnly as $schema_only) {
       if (preg_match('/^' . $schema_only . '$/', $table)) {
         return [];
       }
     }
-    $order = $this->getFieldOrder($table);
-    $query = $this->connection->query("SELECT * FROM {" . $table . "} " . $order );
+    $order = $this->getFieldOrder($connection, $table);
+    $query = $connection->query("SELECT * FROM {" . $table . "} " . $order );
     $results = [];
     while (($row = $query->fetchAssoc()) !== FALSE) {
       $results[] = $row;
@@ -305,6 +288,8 @@ protected function getTableData($table) {
   /**
    * Given a database field type, return a Drupal type.
    *
+   * @param \Drupal\Core\Database\Connection $connection
+   *   The database connection to use.
    * @param string $type
    *   The MySQL field type.
    *
@@ -312,9 +297,9 @@ protected function getTableData($table) {
    *   The Drupal schema field type. If there is no mapping, the original field
    *   type is returned.
    */
-  protected function fieldTypeMap($type) {
+  protected function fieldTypeMap(Connection $connection, $type) {
     // Convert everything to lowercase.
-    $map = array_map('strtolower', $this->connection->schema()->getFieldTypeMap());
+    $map = array_map('strtolower', $connection->schema()->getFieldTypeMap());
     $map = array_flip($map);
 
     // The MySql map contains type:size. Remove the size part.
@@ -324,15 +309,17 @@ protected function fieldTypeMap($type) {
   /**
    * Given a database field type, return a Drupal size.
    *
+   * @param \Drupal\Core\Database\Connection $connection
+   *   The database connection to use.
    * @param string $type
    *   The MySQL field type.
    *
    * @return string
    *   The Drupal schema field size.
    */
-  protected function fieldSizeMap($type) {
+  protected function fieldSizeMap(Connection $connection, $type) {
     // Convert everything to lowercase.
-    $map = array_map('strtolower', $this->connection->schema()->getFieldTypeMap());
+    $map = array_map('strtolower', $connection->schema()->getFieldTypeMap());
     $map = array_flip($map);
 
     $schema_type = explode(':', $map[$type])[0];
@@ -346,24 +333,26 @@ protected function fieldSizeMap($type) {
   /**
    * Gets field ordering for a given table.
    *
+   * @param \Drupal\Core\Database\Connection $connection
+   *   The database connection to use.
    * @param string $table
    *   The table name.
    *
    * @return string
    *   The order string to append to the query.
    */
-  protected function getFieldOrder($table) {
+  protected function getFieldOrder(Connection $connection, $table) {
     // @todo this is MySQL only since there are no Database API functions for
     // table column data.
     // @todo this code is duplicated in `core/scripts/migrate-db.sh`.
-    $connection_info = $this->connection->getConnectionOptions();
+    $connection_info = $connection->getConnectionOptions();
     // Order by primary keys.
     $order = '';
     $query = "SELECT `COLUMN_NAME` FROM `information_schema`.`COLUMNS`
     WHERE (`TABLE_SCHEMA` = '" . $connection_info['database'] . "')
     AND (`TABLE_NAME` = '{" . $table . "}') AND (`COLUMN_KEY` = 'PRI')
     ORDER BY COLUMN_NAME";
-    $results = $this->connection->query($query);
+    $results = $connection->query($query);
     while (($row = $results->fetchAssoc()) !== FALSE) {
       $order .= $row['COLUMN_NAME'] . ', ';
     }
@@ -388,8 +377,6 @@ protected function getTemplate() {
  *
  * This file was generated by the dump-database-d8.php script, from an
  * installation of Drupal 8. It has the following modules installed:
- *
-{{MODULES}}
  */
 
 use Drupal\Core\Database\Database;
@@ -431,20 +418,4 @@ protected function getTableScript($table, array $schema, array $data) {
     return $output;
   }
 
-  /**
-   * List of modules enabled for insertion into the script docblock.
-   *
-   * @return string
-   *   The formatted list of enabled modules.
-   */
-  protected function getModulesScript() {
-    $output = '';
-    $modules = $this->moduleHandler->getModuleList();
-    ksort($modules);
-    foreach ($modules as $module => $filename) {
-      $output .= " *  - $module\n";
-    }
-    return rtrim($output, "\n");
-  }
-
 }
diff --git a/core/lib/Drupal/Core/Command/DbImportCommand.php b/core/lib/Drupal/Core/Command/DbImportCommand.php
new file mode 100644
index 0000000..e519e28
--- /dev/null
+++ b/core/lib/Drupal/Core/Command/DbImportCommand.php
@@ -0,0 +1,74 @@
+<?php
+
+/**
+ * @file
+ * Contains \Drupal\Core\Command\DbDumpCommand.
+ */
+
+namespace Drupal\Core\Command;
+
+use Drupal\Core\Database\Connection;
+use Drupal\Core\Database\Database;
+use Drupal\Core\Database\SchemaObjectExistsException;
+use Symfony\Component\Console\Input\InputInterface;
+use Symfony\Component\Console\Input\InputOption;
+use Symfony\Component\Console\Output\OutputInterface;
+
+/**
+ * Provides a command to import the current database from a script.
+ *
+ * This script runs on databases exported using using one of the database dump
+ * commands and imports it into the current database connection.
+ *
+ * @see \Drupal\Core\Command\DbImportApplication
+ */
+class DbImportCommand extends DbCommandBase {
+
+  /**
+   * {@inheritdoc}
+   */
+  protected function configure() {
+    parent::configure();
+    $this->setName('import')
+      ->setDescription('Import database from a generation script.')
+      ->addArgument('script', InputOption::VALUE_REQUIRED, 'Import script');
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  protected function execute(InputInterface $input, OutputInterface $output) {
+
+    $script = $input->getArgument('script');
+    if (!is_file($script)) {
+      $output->writeln('File must exist.');
+      return;
+    }
+
+    $connection = $this->getDatabaseConnection($input);
+    $this->runScript($connection, $script);
+    $output->writeln('Import completed successfully.');
+  }
+
+  /**
+   * Run the database script.
+   *
+   * @param \Drupal\Core\Database\Connection $connection
+   *   ...
+   * @param string $script
+   *   The PHP script.
+   * @return mixed
+   */
+  protected function runScript(Connection $connection, $script) {
+    if (substr($script, -3) == '.gz') {
+      $script = "compress.zlib://$script";
+    }
+    try {
+      require $script;
+    }
+    catch (SchemaObjectExistsException $e) {
+      throw new \RuntimeException('An existing Drupal installation exists at this location. Try removing all tables or changing the database prefix in your settings.php file.');
+    }
+  }
+
+}
diff --git a/core/lib/Drupal/Core/Command/DbToolsApplication.php b/core/lib/Drupal/Core/Command/DbToolsApplication.php
new file mode 100644
index 0000000..fbf0b4b
--- /dev/null
+++ b/core/lib/Drupal/Core/Command/DbToolsApplication.php
@@ -0,0 +1,34 @@
+<?php
+
+/**
+ * @file
+ * Contains \Drupal\Core\Command\DbToolsApplication.
+ */
+
+namespace Drupal\Core\Command;
+
+use Symfony\Component\Console\Application;
+
+/**
+ * Provides a command to import a database generation script.
+ */
+class DbToolsApplication extends Application {
+
+  /**
+   * {@inheritdoc}
+   */
+  public function __construct() {
+    parent::__construct('Database Tools', '8.0.x');
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  protected function getDefaultCommands() {
+    $default_commands = parent::getDefaultCommands();
+    $default_commands[] = new DbDumpCommand();
+    $default_commands[] = new DbImportCommand();
+    return $default_commands;
+  }
+
+}
diff --git a/core/modules/system/src/Tests/Update/DbDumpTest.php b/core/modules/system/src/Tests/Update/DbDumpTest.php
index 96bcfdb..c695ea1 100644
--- a/core/modules/system/src/Tests/Update/DbDumpTest.php
+++ b/core/modules/system/src/Tests/Update/DbDumpTest.php
@@ -143,21 +143,11 @@ public function testDbDumpCommand() {
       return;
     }
 
-    $application = new DbDumpApplication(Database::getConnection(), $this->container->get('module_handler'));
+    $application = new DbDumpApplication();
     $command = $application->find('dump-database-d8-mysql');
     $command_tester = new CommandTester($command);
     $command_tester->execute([]);
 
-    // The enabled modules should be present in the docblock.
-    $modules = static::$modules;
-    asort($modules);
-    $pattern = preg_quote(implode("\n *  - ", $modules));
-    $this->assertTrue(preg_match('/' . $pattern . '/', $command_tester->getDisplay()), 'Module list is contained in the docblock of the script.');
-
-    // A module that is not enabled should not be listed.
-    $pattern = preg_quote(" *  - telephone");
-    $this->assertFalse(preg_match('/' . $pattern . '/', $command_tester->getDisplay()), 'Disabled modules do not appear in the docblock of the script.');
-
     // Tables that are schema-only should not have data exported.
     $pattern = preg_quote("\$connection->insert('sessions')");
     $this->assertFalse(preg_match('/' . $pattern . '/', $command_tester->getDisplay()), 'Tables defined as schema-only do not have data exported to the script.');
@@ -181,7 +171,7 @@ public function testScriptLoad() {
     }
 
     // Generate the script.
-    $application = new DbDumpApplication(Database::getConnection(), $this->container->get('module_handler'));
+    $application = new DbDumpApplication();
     $command = $application->find('dump-database-d8-mysql');
     $command_tester = new CommandTester($command);
     $command_tester->execute([]);
diff --git a/core/modules/system/tests/src/Kernel/Scripts/DbImportCommandTest.php b/core/modules/system/tests/src/Kernel/Scripts/DbImportCommandTest.php
new file mode 100644
index 0000000..6537aef
--- /dev/null
+++ b/core/modules/system/tests/src/Kernel/Scripts/DbImportCommandTest.php
@@ -0,0 +1,180 @@
+<?php
+
+/**
+ * @file
+ * Contains \Drupal\Tests\system\Kernel\Scripts\DbImportCommandTest.
+ */
+
+namespace Drupal\Tests\system\Kernel\Scripts;
+
+use Drupal\Core\Command\DbImportCommand;
+use Drupal\Core\Config\DatabaseStorage;
+use Drupal\Core\Database\Database;
+use Drupal\KernelTests\KernelTestBase;
+use Symfony\Component\Console\Tester\CommandTester;
+
+/**
+ * Test that the DbToolsApplication works correctly.
+ *
+ * The way console application's run it is impossible to test. For now we only
+ * test that we are registering the correct commands.
+ */
+class DbImportCommandTest extends KernelTestBase {
+
+  /**
+   * {@inheritdoc}
+   */
+  public static $modules = ['system', 'config', 'dblog', 'menu_link_content', 'link', 'block_content', 'file', 'user'];
+
+  /**
+   * Test data to write into config.
+   *
+   * @var array
+   */
+  protected $data;
+
+  /**
+   * Flag to skip these tests, which are database-backend dependent (MySQL).
+   *
+   * @see \Drupal\Core\Command\DbDumpCommand
+   *
+   * @var bool
+   */
+  protected $skipTests = FALSE;
+
+  /**
+   * An array of original table schemas.
+   *
+   * @var array
+   */
+  protected $originalTableSchemas = [];
+
+  /**
+   * An array of original table indexes (including primary and unique keys).
+   *
+   * @var array
+   */
+  protected $originalTableIndexes = [];
+
+  /**
+   * Tables that should be part of the exported script.
+   *
+   * @var array
+   */
+  protected $tables = [
+    'block_content',
+    'block_content_field_data',
+    'block_content_field_revision',
+    'block_content_revision',
+    'cachetags',
+    'config',
+    'cache_discovery',
+    'cache_bootstrap',
+    'file_managed',
+    'key_value_expire',
+    'menu_link_content',
+    'menu_link_content_data',
+    'semaphore',
+    'sessions',
+    'url_alias',
+    'user__roles',
+    'users',
+    'users_field_data',
+    'watchdog',
+  ];
+
+  /**
+   * {@inheritdoc}
+   */
+  public function setUp() {
+    parent::setUp();
+
+    // Determine what database backend is running, and set the skip flag.
+    if (Database::getConnection()->databaseType() !== 'mysql') {
+      $this->markTestSkipped("Skipping test since the DbDumpCommand is currently only compatible with MySql");
+    }
+  }
+
+  /**
+   * Test the command directly.
+   */
+  public function testDbImportCommand() {
+
+    /** @var \Drupal\Core\Database\Connection $connection */
+    $connection = $this->container->get('database');
+    // Drop tables to avoid conflicts.
+    foreach ($this->tables as $table) {
+      $connection->schema()->dropTable($table);
+    }
+
+    $command = new DbImportCommand();
+    $command_tester = new CommandTester($command);
+    $command_tester->execute(['script' => __DIR__ . '/../../../fixtures/update/drupal-8.bare.standard.php.gz']);
+
+    // The tables should now exist.
+    foreach ($this->tables as $table) {
+      $this->assertTrue($connection
+        ->schema()
+        ->tableExists($table), strtr('Table @table created by the database script.', ['@table' => $table]));
+    }
+  }
+
+  /**
+   * Helper function to get a simplified schema for a given table.
+   *
+   * @param string $table
+   *
+   * @return array
+   *   Array keyed by field name, with the values being the field type.
+   */
+  protected function getTableSchema($table) {
+    // Verify the field type on the data column in the cache table.
+    // @todo this is MySQL specific.
+    $query = $this->container->get('database')
+      ->query("SHOW COLUMNS FROM {" . $table . "}");
+    $definition = [];
+    while ($row = $query->fetchAssoc()) {
+      $definition[$row['Field']] = $row['Type'];
+    }
+    return $definition;
+  }
+
+  /**
+   * Returns indexes for a given table.
+   *
+   * @param string $table
+   *   The table to find indexes for.
+   *
+   * @return array
+   *   The 'primary key', 'unique keys', and 'indexes' portion of the Drupal
+   *   table schema.
+   */
+  protected function getTableIndexes($table) {
+    $query = $this->container->get('database')
+      ->query("SHOW INDEX FROM {" . $table . "}");
+    $definition = [];
+    while ($row = $query->fetchAssoc()) {
+      $index_name = $row['Key_name'];
+      $column = $row['Column_name'];
+      // Key the arrays by the index sequence for proper ordering (start at 0).
+      $order = $row['Seq_in_index'] - 1;
+
+      // If specified, add length to the index.
+      if ($row['Sub_part']) {
+        $column = [$column, $row['Sub_part']];
+      }
+
+      if ($index_name === 'PRIMARY') {
+        $definition['primary key'][$order] = $column;
+      }
+      elseif ($row['Non_unique'] == 0) {
+        $definition['unique keys'][$index_name][$order] = $column;
+      }
+      else {
+        $definition['indexes'][$index_name][$order] = $column;
+      }
+    }
+    return $definition;
+  }
+
+}
diff --git a/core/modules/system/tests/src/Kernel/Scripts/DbToolsApplicationTest.php b/core/modules/system/tests/src/Kernel/Scripts/DbToolsApplicationTest.php
new file mode 100644
index 0000000..5dff6fa
--- /dev/null
+++ b/core/modules/system/tests/src/Kernel/Scripts/DbToolsApplicationTest.php
@@ -0,0 +1,39 @@
+<?php
+
+/**
+ * @file
+ * Contains \Drupal\Tests\system\Kernel\Scripts\DbToolsApplicationTest.
+ */
+
+namespace Drupal\Tests\system\Kernel\Scripts;
+
+use Drupal\Core\Command\DbToolsApplication;
+use Drupal\KernelTests\KernelTestBase;
+
+/**
+ * Test that the DbToolsApplication works correctly.
+ *
+ * The way console application's run it is impossible to test. For now we only
+ * test that we are registering the correct commands.
+ */
+class DbToolsApplicationTest extends KernelTestBase {
+
+  /**
+   * Test that the dump command is correctly registered.
+   */
+  public function testDumpCommandRegistration() {
+    $application = new DbToolsApplication();
+    $command = $application->find('dump');
+    $this->assertInstanceOf('\Drupal\Core\Command\DbDumpCommand', $command);
+  }
+
+  /**
+   * Test that the dump command is correctly registered.
+   */
+  public function testImportCommandRegistration() {
+    $application = new DbToolsApplication();
+    $command = $application->find('import');
+    $this->assertInstanceOf('\Drupal\Core\Command\DbImportCommand', $command);
+  }
+
+}
diff --git a/core/scripts/dump-database-d8-mysql.php b/core/scripts/db-tools.php
old mode 100755
new mode 100644
similarity index 77%
copy from core/scripts/dump-database-d8-mysql.php
copy to core/scripts/db-tools.php
index b50f4c0..316c62f
--- a/core/scripts/dump-database-d8-mysql.php
+++ b/core/scripts/db-tools.php
@@ -1,8 +1,7 @@
 #!/usr/bin/env php
 <?php
 
-use Drupal\Core\Command\DbDumpApplication;
-use Drupal\Core\Database\Database;
+use Drupal\Core\Command\DbToolsApplication;
 use Drupal\Core\DrupalKernel;
 use Drupal\Core\Site\Settings;
 use Symfony\Component\HttpFoundation\Request;
@@ -19,5 +18,5 @@
 $kernel = DrupalKernel::createFromRequest($request, $autoloader, 'prod')->boot();
 
 // Run the database dump command.
-$application = new DbDumpApplication(Database::getConnection(), \Drupal::moduleHandler());
+$application = new DbToolsApplication();
 $application->run();
diff --git a/core/scripts/dump-database-d8-mysql.php b/core/scripts/dump-database-d8-mysql.php
index b50f4c0..c4f7507 100755
--- a/core/scripts/dump-database-d8-mysql.php
+++ b/core/scripts/dump-database-d8-mysql.php
@@ -2,7 +2,6 @@
 <?php
 
 use Drupal\Core\Command\DbDumpApplication;
-use Drupal\Core\Database\Database;
 use Drupal\Core\DrupalKernel;
 use Drupal\Core\Site\Settings;
 use Symfony\Component\HttpFoundation\Request;
@@ -19,5 +18,5 @@
 $kernel = DrupalKernel::createFromRequest($request, $autoloader, 'prod')->boot();
 
 // Run the database dump command.
-$application = new DbDumpApplication(Database::getConnection(), \Drupal::moduleHandler());
+$application = new DbDumpApplication();
 $application->run();
