Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
If I try to run this from msysgit Git Bash terminal:
$ drush sql-dump --result-file="C:\wamp\www\test.sql" --gzip
mysqldump: Couldn't find table: ";"
Database dump failed
However, if I leave out the --gzip, it works, although obviously the sql file is not compressed
So this works to do it separately:
$ drush sql-dump --result-file="C:\wamp\www\test.sql"
Database dump saved to C:\wamp\www\test.sql
$ gzip c:/wamp/www/test.sql
Gzip created the test.sql.gz as expected, so my $PATH is working.
Interestingly, this also works to create the test.sql file without errors:
$ mysqldump -u root dbname > c:/wamp/www/test.sql
Comments
Comment #1
greg.1.anderson CreditAttribution: greg.1.anderson commentedThis is probably an escaping issue on Windows; it would be useful to see the --debug output, per the issue submission guidelines, although this is probably easy to reproduce. Adding the 'Windows' tag.
Comment #2
JSCSJSCS CreditAttribution: JSCSJSCS commentedDebug output:
From this I can see that drush is calling:
Which works if I enter it directly, but not if I enter:
Maybe it has something to do with no password in the local MySQL root account? I would think Drush can handle that though. Maybe it has something to do with the ; after the password that works with mysqldump, but not when it is passed through DRUSH's call?
Comment #3
greg.1.anderson CreditAttribution: greg.1.anderson commented;
is the command separator on Linux (and in the msysgit bash shell), but it apparently is not recognized as such on Windows. Maybe && would work better -- or does this have to be & on Windows? You'll have to test by changing the Drush code, or try it in DOS or PowerShell. No time to check right now, but we might already have a "command separator" concept in Drush. If not, we should probably add it.Comment #4
JSCSJSCS CreditAttribution: JSCSJSCS commentedAs you suggested, I changed sql.drush.inc
to:
and initially it is working
Comment #5
greg.1.anderson CreditAttribution: greg.1.anderson commentedTraditionally, Drush has avoided the pipe operator because it reportedly uses more RAM than multi-step operations, which can be a problem on small hosted sites. I have not verified this assumption myself, but it has been policy.
Comment #6
moshe weitzman CreditAttribution: moshe weitzman commentedcommitted proposed fix ... the pipe code is unchanged in the proposal.