I have a production server set up in my drush aliases as @prod, and a UAT server set up as @uat. I am using MySQL as the database of my Drupal sites. I can successfully execute drush command like drush rsync @prod @uat. However, when I execute

drush sql-sync @uat @prod

Error prompts:

bash: mysqldump: command not found

After googling, the solution is to set the $PATH to include /usr/local/mysql/bin, however, I do not have right to install MySQL client.

Here I have 2 questions:

  1. Is it a must to have mysqldump in order to run drush sql-sync?
  2. If so, apart from installing MySQL client, is there any other way to do it?


  • How else would you get a dump of your current database on the command line?
    – leymannx
    Mar 22, 2019 at 14:10

1 Answer 1

  1. Looking at the drush github repo, mysqldump appears to be a non-negotiable dependency. More broadly speaking, given it's functionality, I'm unclear why it wouldn't be. So, yes, drush requires mysqldump for mysql exports.
  2. There's always another way, or expressed without my opinion; "yes." Whether it is a good practice to MacGyver such a solution depends on how much free time you have. There's an interesting php implementation of mysqldump discussed here, but here's where my caveat becomes more clear. Check out the commit activity page — not bad, but on the sparse side for a production solution for my tastes and capacity. So the answer may really depend on how much of this development your client is willing to absorb.

Personally, I'd either convince my sysadmin to allow mysqldump (something I haven't had to do in years) or move my site to a host that will provide such a basic service.

ps: I may be wrong but the Backup and Migrate may give you mysql export capability without mysqldump.

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.