Detailed guide. An unofficial adaptation of User Guide 11.8. Source updated April 14, 2025; reviewed November 6, 2026. No running-Drupal procedure test has been performed.
Official source ↗ · Previous: 11.7 Understanding Development and Production Sites · Chapter 11 overview · Next: 11.9 Deploying a View Configuration
Goal and preparation
Copy database and files to test features or updates. Prepare a separate URL, document root and empty dedicated database with its own credentials. Identify the destination before importing; see environment roles .
Adapted workflow
Export the database using a suitable tool. The source’s Drush example compresses it and omits cache-table data:
drush sql:dump --gzip --structure-tables-list="cache,cache_*" --result-file='PATH/TO/BACKUPFILE.sql'
Store dumps outside web-accessible directories. Copy code and needed uploads, including Composer project files above web. Adjust the copy’s database settings, trusted hosts and hash salt. Do not reuse the source’s literal any_string_value as a shared secret. Import using a method compatible with the database and compression format. We do not blindly reproduce the source’s compressed-file sql:query example. Use settings.php overrides for environment-specific configuration where needed.
DDEV alternative
For a Drupal 11 project with web as document root:
ddev config --project-type=drupal11 --docroot=web
ddev start
ddev import-db --src=PATH/TO/BACKUPFILE.sql.gz
We omit the source display’s trailing + after ddev start. Adjust the project settings if its layout differs.
Our verification examples
We omit password-in-command examples and live cache-table truncation; use appropriate authentication and non-destructive exports. Before using the copy, restrict access and configure test-safe mail, payments and external integrations. Verify login and output after rebuilding caches. No database or DDEV operation was performed here.
Sources, credits and changes
Source: Drupal User Guide 11.8 ↗ . Contributors and source links listed in its Attributions: Jennifer Hodgdon ↗ · Joe Shindelar ↗ · Drupalize.Me · Jojy Alphonso ↗ · Red Crackle . Refer to the source for writing, editing and adaptation roles, and to the guide-wide credits ↗ .
Copyright remains with the individual contributors; the official copyright page ↗ states © 2015–2025. Changes include reorganized explanations and procedures, our preparation and verification examples, troubleshooting notes, source-interpretation qualifications and release references. Original screenshots and videos are not reproduced. This adapted text is shared under CC BY-SA 2.0 . It is not an official edition or endorsement. This notice does not license unrelated articles or the site design.
Chapter navigation
Previous: 11.7 Understanding Development and Production Sites · Chapter 11 overview · Next: 11.9 Deploying a View Configuration
Chapter 10 details · Chapter 12 · All chapters · Search official information