Skip to main content

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

show databases;

Response

+--------------------+
| Database           |
+--------------------+
| information_schema |
| doj                |
| mysql              |
| performance_schema |
| sys                |
+--------------------+

Which changes the database in use to doj... or whatever you want to use.  Now check the database has the tables that have been uploaded

+--------------------------------------------------+
| Tables_in_doj                                    |
+--------------------------------------------------+
| batch                                            |
| block_content                                    |
| block_content__body                              |
| block_content__field_app_stores                  |
| block_content__field_block_visibility            |
| block_content__field_secondary_content           |
| block_content__field_secondary_notice_content    |
| block_content_field_data                         |
| block_content_field_revision                     |
| block_content_r__3a90e2b434                      |
| block_content_revision                           |
| block_content_revision__body                     |
| block_content_revision__field_app_stores         |
| block_content_revision__field_block_visibility   |
| block_content_revision__field_secondary_content  |
| cache_bootstrap                                  |
| cache_config                                     |
| cache_container                                  |
| cache_data                                       |
| cache_default                                    |
| cache_discovery                                  |
| cache_entity                                     |
| cache_flysystem                                  |
| cache_menu                                       |
| cache_toolbar
... |

Looking good.

Clear cache by running 

lando drush cr

However, I was seeing the following error

SQLSTATE[HY000] [1045] Access denied for user '{user}'@'{ip_address}' (using password: YES)

Check you settings file has been configured correctly.

Once confirmed, then destroy the lando environment and rebuild

lando destroy -y && lando start

Not working post rebuild.  Checking the database in verbose mode

lando drush updb -vvv

Which part of the response was:

lando 21:43:54 DEBUG ==> process pid5 running /Applications/Docker.app/Contents/Resources/bin/docker exec orwbase_appserver_1 drush updb cstdio=[inherit, pipe, pipe], silent=false, mode=attach, detached=false
lando 21:43:55 VERBOSE ==> checking docker version compatibility...
lando 21:43:55 DEBUG ==> compatibility results name=desktop, link=https://docs.docker.com/docker-for-mac/release-notes/, wants=2.1.0.0 - 3.6.99, version=3.6.0, semversion=3.6.0, semmin=2.1.0, semmax=3.6.99, dockerVersion=true, satisfied=true
lando 21:43:55 DEBUG ==> engine is up.
                                       lando 21:43:55 DEBUG ==> docker is running.
                                                                                    [preflight] Config paths: /app/vendor/drush/drush/drush.yml,/app/drush/drush.yml
 [preflight] Alias paths: /app/web/drush/sites,/app/drush/sites
 [preflight] Commandfile search paths: /app/vendor/drush/drush/src,/app/drush
 [info] Starting bootstrap to full [0.88 sec, 9.43 MB]
 [info] Drush bootstrap phase 5 [0.88 sec, 9.43 MB]
 [info] Try to validate bootstrap phase 5 [0.88 sec, 9.43 MB]
 [info] Try to validate bootstrap phase 5 [0.88 sec, 9.43 MB]
 [info] Try to bootstrap at phase 5 [0.88 sec, 9.43 MB]
 [info] Drush bootstrap phase: bootstrapDrupalRoot() [0.88 sec, 9.43 MB]
 [info] Change working directory to /app/web [0.88 sec, 9.43 MB]
 [info] Initialized Drupal 9.4.5 root directory at /app/web [0.89 sec, 9.43 MB]
 [info] Try to validate bootstrap phase 5 [0.89 sec, 9.43 MB]
 [info] Try to bootstrap at phase 5 [0.89 sec, 9.46 MB]
 [info] Drush bootstrap phase: bootstrapDrupalSite() [0.89 sec, 9.46 MB]
 [debug] Could not find a Drush config file at sites/default/drush.yml. [0.9 sec, 9.62 MB]
 [info] Initialized Drupal site default at sites/default [0.9 sec, 9.62 MB]
 [info] Try to validate bootstrap phase 5 [0.9 sec, 9.62 MB]
 [info] Try to bootstrap at phase 5 [0.9 sec, 9.62 MB]
 [info] Drush bootstrap phase: bootstrapDrupalConfiguration() [0.9 sec, 9.62 MB]
 [debug] Add service modifier [0.92 sec, 9.9 MB]
 [info] Try to validate bootstrap phase 5 [0.93 sec, 9.9 MB]
 [info] key_value table not found. Database may be empty. [0.95 sec, 10.47 MB]
 [info] Could not bootstrap at phase 5 [0.95 sec, 10.47 MB]

In BootstrapHook.php line 36:

  [Exception]
  Bootstrap failed. Run your command with -vvv for more information.


Exception trace:
  at /app/vendor/drush/drush/src/Boot/BootstrapHook.php:36
 Drush\Boot\BootstrapHook->initialize() at /app/vendor/consolidation/annotated-command/src/Hooks/Dispatchers/InitializeHookDispatcher.php:44
 Consolidation\AnnotatedCommand\Hooks\Dispatchers\InitializeHookDispatcher->doInitializeHook() at /app/vendor/consolidation/annotated-command/src/Hooks/Dispatchers/InitializeHookDispatcher.php:36
 Consolidation\AnnotatedCommand\Hooks\Dispatchers\InitializeHookDispatcher->callInitializeHook() at /app/vendor/consolidation/annotated-command/src/Hooks/Dispatchers/InitializeHookDispatcher.php:29
 Consolidation\AnnotatedCommand\Hooks\Dispatchers\InitializeHookDispatcher->initialize() at /app/vendor/consolidation/annotated-command/src/CommandProcessor.php:145
 Consolidation\AnnotatedCommand\CommandProcessor->initializeHook() at /app/vendor/consolidation/annotated-command/src/AnnotatedCommand.php:335
 Consolidation\AnnotatedCommand\AnnotatedCommand->initialize() at /app/vendor/symfony/console/Command/Command.php:221
 Symfony\Component\Console\Command\Command->run() at /app/vendor/symfony/console/Application.php:1027
 Symfony\Component\Console\Application->doRunCommand() at /app/vendor/symfony/console/Application.php:273
 Symfony\Component\Console\Application->doRun() at /app/vendor/symfony/console/Application.php:149
 Symfony\Component\Console\Application->run() at /app/vendor/drush/drush/src/Runtime/Runtime.php:124
 Drush\Runtime\Runtime->doRun() at /app/vendor/drush/drush/src/Runtime/Runtime.php:51
 Drush\Runtime\Runtime->run() at /app/vendor/drush/drush/drush.php:72
 require() at /app/vendor/drush/drush/drush:4
 include() at /app/vendor/bin/drush:120

The issue is with Bootstrap.  Now checking composer packages are up to date

lando composer update

 

Related articles

Andrew Fletcher25 Sep 2022

Adding Tailwind css to Drupal

Tailwind CSS is a highly customisable framework that delivers developers the tools to quickly pull your site together.   Initial Configuration The installation and configuration steps are essentially the same as those outlined within the Tailwind documentation. Note they need to be...
Andrew Fletcher07 Sep 2022

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 ...