---
title: "A Simple Guide to a Drupal 7 to Drupal 9 Migration from a Database Source"
description: "Want to migrate to Drupal 9 but don’t know where to begin? Check out this basic guide to a Drupal 7 to 9 migration from a database source."
url: https://www.specbee.com/blogs/drupal-7-to-drupal-8-or-drupal-9-migration-from-database-source
type: Article
author: "Santhosh Kumar"
categories: "Code Corner"
published: 2021-04-06
updated: 2026-10-09
---

# A Simple Guide to a Drupal 7 to Drupal 9 Migration from a Database Source

If you are a Drupal website owner, developer, admin or a user, you should already know that Drupal 10 is coming soon - June 2022. And that’s just over a year to go! The advantages of migrating to the most updated version of a software are priceless. More so when you have a community of open-source enthusiasts working towards a single goal of improving Drupal every single day, you must trust that migrating to the latest version of Drupal is going to be one of the best decisions you will make.

If you’re still on Drupal 7, it’s about time to migrate to Drupal 9. There are many ways of migrating your website from [Drupal 7](https://www.specbee.com/blogs/drupal-7-to-8-migration-how-guide-addresses-migrations-challenges-recommendations) to [Drupal 9](https://www.specbee.com/blogs/drupal-9-readiness-checklist-are-you-prepared-for-a-better-tomorrow)). Here’s a no-frills guide to migrating your Drupal 7 website from a database source.

## What is a Drupal Migration?

[Migration](https://www.specbee.com/services/drupal-migration-upgrade) is a movement of content from Drupal 7 to Drupal 9. This includes configuration (content types, vocabularies, user roles, file types, image styles, etc.) and contents (users, nodes, paragraphs, taxonomy terms etc.)

 ![Drupal 7 to Drupal 9](https://www.specbee.com/sites/default/files/styles/large/public/migrated/Drupal7_to_Drupal9_0.png.avif?itok=xU8Be7ZF)

 

 ## The ETL Process

No matter what your [source](https://www.specbee.com/blogs/how-migrate-drupal-8-sql-source-6-simple-steps) or destination is for a migration, a [Drupal migration](https://www.specbee.com/blogs/top-13-questions-about-migrating-to-Drupal-8-answers-included) will follow the ETL process or the **Extract – Transform – Load** process. The first step is the **Extraction** step where the data is extracted from the source plugin. The next step is the Transformation step where the extracted data is processed according to the requirements by the process plugin. And lastly, the Loading step where the data is loaded into the storage by the destination plugin.

 ![Process Plugin](https://www.specbee.com/sites/default/files/styles/large/public/migrated/Process_Plugin_0.png.avif?itok=WryZTmhA)

 

 ## Migration Plugins and Modules

### 1. Source plugin

A set of data, called row from the source. They help fetch data from the source like a database, CSV, XML or JSON.

### 2. Process plugin

Row data will be processed and transformed as required. It describes how the destination is to be built from the source data.

### 3. Destination plugin

Once processed, the transformed row is saved to the destination in the Drupal site.

### Modules Required

- Migrate Module – Contains APIs to migrate content and configuration to Drupal 9.
- Migrate Drupal Module – Helps in migrating content and configuration from a Drupal source site to Drupal 9.
- Migrate Drupal UI Module – A user interface to perform the migration.
- Migrate plus Module – Provides capabilities to transform source data and APIs for grouping migrations.
- Migrate tools Module – A contributed module that offers extended drush commands to manage Drupal 9 migrations.
- Drupal upgrade – A contributed module used to create the migration YML scripts.

## How do I Migrate to Drupal 9: The Groundwork 

Now that we have a fairly good understanding of some of the [basic migration concepts](https://www.specbee.com/blogs/migrating-drupal-7-drupal-8-brief-guide) and have installed the basic modules needed for the migration (as discussed above), let’s look at a few simple steps to follow before actually commencing a Drupal 7 to Drupal 9 migration:

- Audit the Drupal 7 site for contributed modules. Many of the fields in the Drupal 7 content types will depend on contributed modules. So, we will need to check for those modules and install the same in[ Drupal 9](https://www.specbee.com/blogs/drupal-8-now-or-drupal-9-later-whats-right-thing-do).
- Install the contributed modules if it is not incorporated in Drupal 9 core.
- Install the supportive core modules like revisions, translations, etc. if needed.
- Have the Drupal 7 database and files accessible by the Drupal 9 instance.
- Select the method of migration Bulk or Individual carefully based on the complexity of the site.

## Connecting to the Drupal 7 Database

Now we will need to connect to the source database of the Drupal 7 website. For that, we will need to add the source database information in the Drupal 9 settings file.

Go to **settings.php** file of your Drupal 9 site and add the database with migrate key and run this command:

```plaintext
drush migrate-upgrade --configure-only --legacy-db-key=migrate --
legacy-root=https://www.drupal7.com/
```

Or you could also directly configure using this URL:

```plaintext
drush migrate-upgrade --configure-only 
--legacy-db-url=mysqli://drupaluser@127.0.0.1:33067/drupal7_db --
legacy-root=https://drupal7.com/
```

The above commands will generate migration YMLs based on the Drupal 7 configuration and contents. It will not start the migration as we added the option **“--configure-only”**.

## Drupal 7 to Drupal 9 Migration - Bulk import

To perform a bulk migration on all configurations and contents to Drupal 9, you will need to execute these commands :

```plaintext
drush migrate:import --tag=Configuration --execute-dependencies
```

This will run all the configuration migrations by running the dependencies at first.

```plaintext
drush migrate:import --tag=Content --execute-dependencies
```

This command will run all the content migrations by running the dependencies at first. Please Note: The migration order is important.

***Please Note: The migration order is important.***

## Drupal 7 to Drupal 9 Migration - Individual import

Sometimes, you might not want to migrate ALL of your content of configurations at one shot. You can then opt to migrate them individually. However, you will need to keep in mind to migrate them in order.

1. Configuration: User roles, vocabularies, content types, image styles, fields, field instances etc.
2. Content: Files, paragraphs, Users, terms, nodes, etc.

## Migration Tools drush Commands

The Migration Tools module (as discussed previously) is a contributed module that gives you some tools and commands that will help you during a migration. Some of the commands include:

- **drush ms -** Migration status
- **drush mim `<migration>`** - Migration import

Imports the data from Drupal. We can also run the import with a limit. For example: drush mim --limit=10

- **drush mr `<migration>`** - Migration rollback
- **drush mmsg `<migration>`** - Migration message

Shows the captured message (error or notice) after the migration import.

## Final thoughts

A Drupal 7 to 9 migration can be easily performed with Drupal’s core migrate modules itself. Other contributed modules like Migration Tools will provide more flexibility while running the migrations. Core migration API is extremely powerful and we can migrate any kind of content provided by the ETL plugins. Drupal’s flexibility also allows us to create our own custom plugins to achieve any custom migrations. When your Drupal 7 site has complex field structures, custom entities or heavily customised modules, an experienced [Drupal development team](https://www.specbee.com/services/drupal-web-development) can write the source and process plugins your migration needs instead of forcing your content into what core supports. Need assistance in [migrating](https://www.specbee.com/services/drupal-migration-upgrade) your Drupal 7 website to Drupal 9? [We would love to help](https://www.specbee.com/contact)!