I am working my way through the Drush chapter in Definitive Guide to Drupal 7 by Apress. I want to sync the mysql database and files to/from my local MAMP developer stack and the remote live server (shared hosting).

Given that the drush rync commands deal with the files and the database, then surely it is not necessary to have to have drush on the remote server? If it has to be on the remote server the I accept that but please explain why. I do appreciate that other drush operations would require it e.g. core-status though but the aforementioned operations I am doing involve just the drupal code and database not anything to do with drush.

Please advise, guides don't state everything and make assumptions sometimes.

1 Answer 1


Drush is needed on the remote server only to fetch the database credentials for the remote system. If you declare your databases array in the site alias for your remote systems, then Drush will not need to have Drush installed on the remote machine to work.

I don't remember if I explained this in detail in the book, but there is an example on how to define database records in aliases in the example alias configuration file, example.aliases.drushrc.php. Also, try running drush @site sa --with-db to see the whole site alias record for the given site with the databases array included. This won't help you if Drush is not installed on the system where the site is installed, but you can run it on a local site, and edit the result to match the necessary settings for the remote end.

  • Thanks @greg_1_anderson I just tried to drush sync and drush sql-sync to my remote shared hosting and they seem like they could work. I say seem because I get errors with the file sync and I think that is because I am sync to the wrong place on the remote machine (should be solvable) and errors with the sql sync where it can't connect to my local sql (again resolvable but I'm using homebrew as a shell and MAMP as for a local dev stack and I think an issue maybe that there are 2 installations of mysql and I would prefer to hook them up to be the same. Apr 5, 2013 at 0:59
  • I've had to hack up my mac a lot so might switch to the drupal vagrant project and run it all within a Linux VM on my mac and ditch MAMP altogether - so that all this drush stuff will work. Apr 5, 2013 at 1:00
  • Also some suggestions about errors in the Drupal 7 Definitive Guide Apress book, not sure if some revisions fix these: 1) In the drush chapter drush extras is mentioned: Project drush_extras (7.x-4.0) downloaded to /home/user/.drush/drush_extras. but there doesn't seem to be a 7.x-4.0 version on the drupal.org/project/drush_extras and drush itself only offers 7.x-1.x-dev 2) an "examples directory" is mentioned but nowhere does it say where this is - exact path on the local drush install would be useful or if it is a download to accompany the book. Apr 5, 2013 at 1:04
  • I can accept your answer though: "f you declare your databases array in the site alias for your remote systems, then Drush will not need to have Drush installed on the remote machine to work." I have created an alias file on my local machine here: /Users/robertdavis/.drush/aliases.drushrc.php and in it defined a live alias based on the example file on drush.org - I will also check out your example too. Apr 5, 2013 at 1:07

Your Answer

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

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