diff --git a/core/lib/Drupal/Core/Command/DbImportApplication.php b/core/lib/Drupal/Core/Command/DbImportApplication.php
new file mode 100644
index 0000000..e9f8739
--- /dev/null
+++ b/core/lib/Drupal/Core/Command/DbImportApplication.php
@@ -0,0 +1,78 @@
+<?php
+
+/**
+ * @file
+ * Contains \Drupal\Core\Command\DbImportApplication.
+ */
+
+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;
+
+/**
+ * Provides a command to import a database generation script.
+ */
+class DbImportApplication 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) {
+    return 'import-database';
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  protected function getDefaultCommands() {
+    // Even though this is a single command, keep the HelpCommand (--help).
+    $default_commands = parent::getDefaultCommands();
+    $default_commands[] = new DbImportCommand($this->connection, $this->moduleHandler);
+    return $default_commands;
+  }
+
+  /**
+   * {@inheritdoc}
+   *
+   * Overridden so the application doesn't expect the command name as the first
+   * argument.
+   */
+  public function getDefinition() {
+    $definition = parent::getDefinition();
+    // Clears the normal first argument (the command name).
+    $definition->setArguments();
+    return $definition;
+  }
+
+}
diff --git a/core/lib/Drupal/Core/Command/DbImportCommand.php b/core/lib/Drupal/Core/Command/DbImportCommand.php
new file mode 100644
index 0000000..c4026e7
--- /dev/null
+++ b/core/lib/Drupal/Core/Command/DbImportCommand.php
@@ -0,0 +1,103 @@
+<?php
+
+/**
+ * @file
+ * Contains \Drupal\Core\Command\DbDumpCommand.
+ */
+
+namespace Drupal\Core\Command;
+
+use Drupal\Component\Utility\Variable;
+use Drupal\Core\Database\Connection;
+use Drupal\Core\Database\SchemaObjectExistsException;
+use Drupal\Core\Extension\ModuleHandlerInterface;
+use Symfony\Component\Console\Command\Command;
+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 Command {
+
+  /**
+   * The database connection.
+   *
+   * @var \Drupal\Core\Database\Connection $connection
+   */
+  protected $connection;
+
+  /**
+   * The module handler.
+   *
+   * @var \Drupal\Core\Extension\ModuleHandlerInterface
+   */
+  protected $moduleHandler;
+
+  /**
+   * 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) {
+    $this->connection = $connection;
+    $this->moduleHandler = $module_handler;
+    parent::__construct();
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  protected function configure() {
+    $this->setName('import-database')
+      ->setDescription('Import database from a generation script.')
+      ->addArgument('script', InputOption::VALUE_REQUIRED, 'Import script');
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  protected function execute(InputInterface $input, OutputInterface $output) {
+
+    // This would save a lot of headaches but it is protected.
+//    $this->connection->setPrefix('import_');
+
+    $script = $input->getArgument('script');
+    if (!is_file($script)) {
+      $output->writeln('File must exist.');
+      return;
+    }
+
+    $this->runScript($script);
+    $output->writeln('Import completed successfully.');
+  }
+
+  /**
+   * Run the database script.
+   *
+   * @param string $script
+   *   The PHP script.
+   * @return mixed
+   */
+  protected function runScript($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/scripts/import_database.php b/core/scripts/import_database.php
new file mode 100644
index 0000000..c558e48
--- /dev/null
+++ b/core/scripts/import_database.php
@@ -0,0 +1,23 @@
+#!/usr/bin/env php
+<?php
+
+use Drupal\Core\Command\DbImportApplication;
+use Drupal\Core\Database\Database;
+use Drupal\Core\DrupalKernel;
+use Drupal\Core\Site\Settings;
+use Symfony\Component\HttpFoundation\Request;
+
+if (PHP_SAPI !== 'cli') {
+  return;
+}
+
+// Bootstrap.
+$autoloader = require __DIR__ . '/../../autoload.php';
+require_once __DIR__ . '/../includes/bootstrap.inc';
+$request = Request::createFromGlobals();
+Settings::initialize(dirname(dirname(__DIR__)), DrupalKernel::findSitePath($request), $autoloader);
+$kernel = DrupalKernel::createFromRequest($request, $autoloader, 'prod')->boot();
+
+// Run the database dump command.
+$application = new DbImportApplication(Database::getConnection(), \Drupal::moduleHandler());
+$application->run();
