Most Recent Article

Using Drush sql-sync ~ Overcoming Windows Issues

Tue, 03/26/2013 - 12:35 -- James Sinkiewicz

Why Use Drush sql-sync

Drush's 'sql-sync' command is meant to very handily merge a local Drupal site database with a remote site's database without having to take all the individual steps of creating a remote database dump file (using drush sql-dump), transferring the dump file to the local server (using drush rsync), and then importing it into the local database (drush sqlc < localdb.sql).

(***Note: This post assumes a rudimentary knowledge of Drush alias file usage. Please read Drush's examples.aliases.drushrc.php file for more information. The aliases used in the examples are specified as 'dev' and 'prod' in my 'mdj.aliases.drushrc.php' file which is located in my C:\Users\USERNAME\.drush directory in Windows 7. Also, I am using the latest development version of Drush, which as of this writing is 6.x-dev (8.x-1.x branch)

Using Drush sql-sync

In the following command line, I am asking Drush to run a 'sql-sync' between my source alias '@mdj.prod' and my target alias '@mdj.dev' and to do so in simulation mode. Don't try this in Windows Powershell. You will get some nearly unintelligible error about "splatted variables", whatever those are. (Edit 03/28/2013: See comments for solution.)