0

I've created proper aliases and successfully pulled files/database from live to dev server by:

drush sql-sync @live @dev

But I noticed my secondary database (defined also in settings.php and in alias file) has not been populated when syncing. I have default database and one additional database for some special operations which I use.

There was no any error message after sync, so I presume drush did not try to copy that database.

Is there any additional procedure I must follow when doing sync of 2 databases, or this was presumed to be automatic?

If there is no out-of-the-box answer, or I should show my config files?

1 Answer 1

2

Drush sql-sync will only copy one database per run; if you have multiple databases to copy, you must run sql-sync multiple times. Use --source-database=other and --target-database=other to specify some other database. Use --source-target=mirror and --target-target=mirror if you want to copy a secondary mirror of your Drupal database (not your use-case).

Rename 'other' and 'mirror' to match the appropriate key of your database record. See figure below.

Array
(
    [default] => Array
        (
            [default] => Array
                (
                    [driver] => mysql
                    [username] => www-data
                    [host] => localhost
                    [database] => drupaldb
                )
            [mirror] => Array
                (
                    [driver] => mysql
                    [username] => www-data
                    [host] => localhost
                    [database] => mirrordrupaldb
                )

        )
    [other] => Array
        (
            [default] => Array
                (
                    [driver] => mysql
                    [username] => www-data
                    [host] => localhost
                    [database] => otherdb
                )

        )

)

Update from NenadP:

It seems that you need to add --strict=0 when using Drush 5 to work around a bug in the sql-sync command definition. This has been fixed in Drush 8.6-6.x.

9
  • Tnx Greg, i hoped it is something that easy ;) asked same on drupal.org but one here gets a shiny medals. BTW your guidances spawned across the web are very helpfull.
    – NenadP
    Commented Feb 26, 2013 at 7:04
  • 1
    I answer questions in the Drush issue queue as well, although now that you mention it, there was a day recently where I saw five support requests all pop up at the same time, and didn't have time to answer them. You can always bump d.o issues that don't get answers after a while, if they don't get any play the first time. I tend to think that Stack Exchange is a better place to ask support questions, though, as more people seem to see the questions here. In any event, a kind word of thanks is an even better reward than a shiny medal, so thanks for the thanks! Commented Feb 26, 2013 at 16:08
  • Yes, I also deem highly Drupal StackExchange, I get answers much faster comparing to opening issue on Drupal.org. Somehow I ended up posting it here and there. It would be good if they can "integrate" it in some way. Also, giving answers here is so much rewarding, and I reckognize people better here than on drupal.org. It might be because of icons, reputation and all that stuff. :D
    – NenadP
    Commented Feb 26, 2013 at 22:44
  • btw tnx for explaining mirror db as bonus :)
    – NenadP
    Commented Feb 27, 2013 at 7:56
  • 1
    Sad but true--there are bugs in the latest stable. All Drush maintainers use HEAD of 8.x-6.x on a day-to-day basis. An effort is made to backport bug fixes from 8.x-6.x to 7.x-5.x, but not all make it, and new stable releases are made only periodically. Hint: 7.x-5-x dev == latest stable plus backported bug fixes from 8.x-6.x, so its usually safe to use. Commented Feb 28, 2013 at 14:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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