1

I have a Drupal 8 site running in Lando. I need to have the 8 site connect to a Drupal 7 database so I can run a migration.

My understanding is I can import an additional database through Lando, but from the documentation I cannot figure out exactly how to do this.

I've tried adding this to my .lando.yml:

services:
  legacydatabase:
    type: mysql
    creds:
      user: root
      password:
      database: legacy

and then multiple attempts at the lando db-import command to no avail.

I need to know what exactly goes in .lando.yml and then what exactly goes in the lando db-import arguments to get this working.

  • 1
    What's Lando? Seems like it's a fairly important part of the puzzle... – Jaypan Jan 17 '18 at 1:46
2

Try this:

services:
  database2:
  type: mariadb

The creds will be set as:

"creds": {
  "user": "mariadb",
  "password": "password",
  "database": "database"
},
  • This looks good, but I think you need to add another level of indenting for type. – RoloDMonkey Nov 20 '18 at 14:20
2

You are on the right track. You can use

services:
  legacydatabase:
    type: mysql

And do a lando rebuild to spin up a second DB server. If you did not specify the credentials you can check them with lando info.

To use db-import (or export) you have to specify which host to use. By default it uses 'database' and not legacydatabase or whatever you called your second DB server. As per the documentation: Options: --host, -h The database service to use [default: "database"]

So the command to use in your case would be:

lando db-import --host legacydatabase [your_mysql_file]

  • This worked great for me. Just wanted to note that I am running lando v3.0.0-rc.22. I was then able to run lando drush migrate-upgrade --legacy-db-url=mysql://mysql:mysql@legacydatabase.APPNAME.internal/database – ben.hamelin Jan 31 at 16:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.