Skip to main content

Running Drupal 9 locally with lando using remote files and db

Import a database

lando db-import doj.sql

Enter the MySQL database

lando mysql -h database

This action will change the prompt as you are now in mysql.  The prompt will start with

mysql>

Now change to the database that you want to use

use doj;

If you want to know what databases exist, then run

Drush - rebuild node access permissions

How do you rebuild node access permissions using CLI?

To rebuild permissions from the command-line using Drush:

drush php-eval 'node_access_rebuild();'

Or using Drupal Console:

drupal node:access:rebuild

 

Importing and Exporting a MySQL database with Drush

These steps are for Drupal 8 and 9.

 

Export your database

Order here is important.  First you want to clear all the Drupal caches.  Then export / dump the db the sql database to a file in your home directory.

drush cr
drush sql-dump > path/to/your/file/ourpout/sql-dump-file-name.sql

or

Set-up Docker for Drupal

Is Docker installed?

Check if your installation is ok and spin up Docker as well:

docker -D info

 

Using Docker

Now it's time to download and install docker images. Using the official images of MariaDB and Drupal. If you don’t specify the absolute URL to the image it will be searched and downloaded from Docker Hub. Tag 'latest' will be used by default.

Setting up synonyms on your Drupal site with a few errors you might experience along the way

Having Drupal Solr Search APi running, I thought adding synonyms to the mix would be a smooth process.

 

Install synonym module

I cam across a synonym module created by Jens Beltofte - Search API Synonym.  Working on a Drupal 9.3.x installation, this module needs to be accessed via Git Search API Synonym,

Install / uninstall modules and themes using composer


Using Composer to Manage Projects and if required their dependencies

In this section, we're going to dive into how to use Composer to manage project dependencies. Specifically, we'll cover the following:

common Drush commands

If your Composer project doesn't have Drush listed as a dependency, you can install Drush from command line as follows:

composer require drush/drush

To check your version of Drush, use

drush --version

 

Status check

drush status

Will output something similar to

Subscribe to Drush