With Copilot
Acquia Copilot is a conversational AI connected into our product documentation and knowledge base. Ask Copilot about product features, technical details, troubleshooting and how to get started with Acquia products.
Sign in to use Acquia Copilot
This page describes manually importing the database of an existing Drupal application into Cloud Platform, as part of the process of manually importing the entire application. For information about other methods of importing an application, see Importing an existing application.
If you have Drush configured for the source version of your application and your Acquia environments, you can use drush to synchronize them.
To import a single website’s database from a drush alias source, use the drush sql:sync command, replacing [source] and [target] with the Drush aliases for your source and target databases. Because Drush 9 or later no longer supports two remote targets, you must arrange for one Drush alias to be local by running the command from either application.
drush sql:sync @[source] @[target]After the import completes, run drush @[target] cr command to rebuild caches.
For more information, see Use Drush to Sync Your Drupal Installations Between Multiple Environments.
To import a database using command-line tools:
To export the data stored in your website’s database, create a database dump file from the command line by running either Drush or mysqldump from your Drupal directory:
In Drush 9 and later, a dump can’t be consistently made from aliases because it ignores output redirection. Instead, go to the source Drupal directory, and then run the following command:
drush @[source] sql:dump --gzip --result-file=../mysite.sqlDrush saves the mysite.sql.gz site archive file relative to your current Drupal docroot. If needed, move the file to a location that has access to your target environment.
If the command returns error messages, ensure Drush has the required permissions to save files in the directory.
After you create the database dump file from your existing database, import the database dump file into the new database.
To import a database dump file into your subscription on Cloud Platform:
Import your database dump file using one of the following methods:
You can now import files using Secure File Transfer Protocol (SFTP), Secure Copy (SCP), or rsync.
The following legend contains the values of the variables used in the previous commands.
[site]: The name of your application on Cloud Platform.[env]: The environment into which you are importing your database. Acceptable values are dev (Development), test (Staging), and prod (Production).[db_name]: The name of your database. Use the database name shown on the Databases page for the environment, not an environment-specific name. For example, if your sitename is example, your default database name will probably be example, and you should use that rather than an environment-specific name (such as exampledev or exampletest).docrootIf you’re not sourcing from the default site, you must specify a matching URI to allow Drush to select the correct site database.
drush @[source] sql:dump --gzip --uri=my.source.com --result-file=../mysite.sqlFor more information, see About Drupal multisite installations.
To import a database dump file to the default site, use the drush sql:cli command, replacing [target] with the Drush alias for your target site:
gunzip -c [/path/to/db/dump/file] | drush @[target] sql:cliIf you’re not targeting the default site, you must include URI as a CLI option or in a custom Drush alias:
gunzip -c [/path/to/db/dump/file] | drush @[target] sql:cli --uri=my.fake.site.comFor more information, see About Drupal multisite installations.
If this content did not answer your questions, try searching or contacting our support team for further assistance.
docrootIf you’re not sourcing from the default site, you must specify a matching URI to allow Drush to select the correct site database.
drush @[source] sql:dump --gzip --uri=my.source.com --result-file=../mysite.sqlFor more information, see About Drupal multisite installations.
To import a database dump file to the default site, use the drush sql:cli command, replacing [target] with the Drush alias for your target site:
gunzip -c [/path/to/db/dump/file] | drush @[target] sql:cliIf you’re not targeting the default site, you must include URI as a CLI option or in a custom Drush alias:
gunzip -c [/path/to/db/dump/file] | drush @[target] sql:cli --uri=my.fake.site.comFor more information, see About Drupal multisite installations.
If this content did not answer your questions, try searching or contacting our support team for further assistance.