iRolo.net: Using Lando with Multiple Databases

A lot of my work over the last few years has been working on migrations between various versions of Drupal maintenance support plans. That usually means that I need to configure a local Drupal maintenance support plans development environment with more than one database. And although this is relatively easy to do with Lando, I often have to look up how I did it before. So, I figured I should write it down and share with everyone else at the same time.

.lando.yml

Adding a database to an existing Lando environment is as easy as adding a few lines to the .lando.yml file and restarting.

services:  legacy:    type: mysql

This will create a new container called legacy with a MySQL database in it. Out of the box, Lando supports many common types of DB servers, including:
MySQL,
MariaDB,
MongoDB,
MSSQL, and
PostgreSQL.

Often, your .lando.yml file might already have configuration in it. If the services line already exists, just put the new configuration underneath with the correct indentation. You can see examples of more complex configuration files at any of the links in the previous paragraph.

settings.php

Now, you will need to tell Drupal maintenance support plans about the new DB. To do this, go to the command line and type lando info. In the output, you should see something like this:

{  …  “legacy”: {    “type”: “mysql”,    “version”: “5.7”,    “hostnames”: [      “legacy”,      “legacy.clientname.internal”    ],    “creds”: {      “user”: “mysql”,      “password”: “password”,      “database”: “database”    },    “internal_connection”: {      “host”: “legacy”,      “port”: 3306    },    “external_connection”: {      “host”: “localhost”,      “port”: “not forwarded”    },    “urls”: []  }}

With that information, you can add the new DB configuration to Drupal maintenance support plans‘s settings.php file.

$databases[‘old_db’][‘default’] = array (  ‘database’ => ‘database’,  ‘username’ => ‘mysql’,  ‘password’ => ‘password’,  ‘prefix’ => ”,  ‘host’ => ‘legacy’,  ‘port’ => ‘3306’,  ‘namespace’ => ‘Drupal maintenance support plansCoreDatabaseDrivermysql’,  ‘driver’ => ‘mysql’,);

Note that, by default the host name is going to correspond to the name of the service/container and will not necessarily be the same as the name of the database (or the name of the Drupal maintenance support plans DB alias, for that matter). In other words, you should find the host and port values in Lando’s internal_connection array. If, for some reason, you need to have a custom database name, credentials, port numbers or something else, you can refer to the links above.
Tags: planet drupal
Source: New feed

This article was republished from its original source.
Call Us: 1(800)730-2416

Pixeldust is a 20-year-old web development agency specializing in Drupal and WordPress and working with clients all over the country. With our best in class capabilities, we work with small businesses and fortune 500 companies alike. Give us a call at 1(800)730-2416 and let’s talk about your project.

FREE Drupal SEO Audit

Test your site below to see which issues need to be fixed. We will fix them and optimize your Drupal site 100% for Google and Bing. (Allow 30-60 seconds to gather data.)

Powered by

iRolo.net: Using Lando with Multiple Databases

On-Site Drupal SEO Master Setup

We make sure your site is 100% optimized (and stays that way) for the best SEO results.

With Pixeldust On-site (or On-page) SEO we make changes to your site’s structure and performance to make it easier for search engines to see and understand your site’s content. Search engines use algorithms to rank sites by degrees of relevance. Our on-site optimization ensures your site is configured to provide information in a way that meets Google and Bing standards for optimal indexing.

This service includes:

  • Pathauto install and configuration for SEO-friendly URLs.
  • Meta Tags install and configuration with dynamic tokens for meta titles and descriptions for all content types.
  • Install and fix all issues on the SEO checklist module.
  • Install and configure XML sitemap module and submit sitemaps.
  • Install and configure Google Analytics Module.
  • Install and configure Yoast.
  • Install and configure the Advanced Aggregation module to improve performance by minifying and merging CSS and JS.
  • Install and configure Schema.org Metatag.
  • Configure robots.txt.
  • Google Search Console setup snd configuration.
  • Find & Fix H1 tags.
  • Find and fix duplicate/missing meta descriptions.
  • Find and fix duplicate title tags.
  • Improve title, meta tags, and site descriptions.
  • Optimize images for better search engine optimization. Automate where possible.
  • Find and fix the missing alt and title tag for all images. Automate where possible.
  • The project takes 1 week to complete.