Guides

Connecting and Using Additional/External Databases

While many Drupal developers rely solely on using the default database/schema for their Drupal installation, there are many projects that require the use of external and non-default databases. Let's look at how we did that in Drupal 7 and then learn how to do it in Drupal 8 and beyond.

 

settings.php

 
The Old Way

In Drupal 7, in order to inform Drupal about your database, you would define the connection in settings.php in an array:

Custom Module Development: D8+ for the D7 Developer

Drupal 7 to Drupal 8, A Huge Jump

At the time of writing this, there are approximately 400,000 websites that are still running Drupal 7 and, with end of life approaching in January of 2025, there isn't much time left to make the change. I can only guess that one significant reason for those who haven't yet migrated is due to just how unbelievably (and intimidatingly) different Drupal became after the launch of Drupal 8. There are a million guides on how to migrate nodes, but custom modules are complicated and we need more examples for developers to follow.