I am trying to get backup of DB using following command

php -dmemory_limit=1G bin/magento support:backup:db

It is giving me syntax error:

sh: 2: Syntax error: word unexpected (expecting ")")
Error: Command returned non-zero exit code:
`(/usr/bin/nice -n 15 /usr/bin/mysqldump -uxxxx -hxxxx  -p"xxxx" xxxx --skip-extended-insert  customer_entity customer_entity_varchar customer_address_entity customer_address_entity_varchar customer_grid_flat quote quote_address sales_order sales_order_address sales_order_grid 2>&1 | /usr/bin/php -r 'while ($line=fgets(STDIN)) {
           if (preg_match("/(^INSERT INTO\s+\S+\s+VALUES\s+)\((.*)\);$/",$line,$matches)) {
               $row = str_getcsv($matches[2],",","\x27");
               foreach($row as $key=>$field) {
                   if ($field == "NULL") {
                   } elseif ( preg_match("/[A-Z]/i", $field)) {
                       $field = md5($field . rand());
                   $row[$key] = "\x27" . $field . "\x27";
               echo $matches[1] . "(" . implode(",", $row) . ");\n";
           echo $line;

I didn't tried this command before and never faced this type of error, can anyone guide me how can I resolve this error?


3 Answers 3


I have not seen support:backup:db command yet.

To take the backup of database, the command i have used is

php -dmemory_limit=1G bin/magento setup:backup --db
  • I will check, will let you know Apr 4, 2019 at 7:13
  • It worked. Thanks Apr 5, 2019 at 5:01

Try to run the below command it is also used for the tacking backups in magento 2

php bin/magento setup:backup --db --code --media

Through this command magento will backup your required data (source_code, database, Media files) to the Magento_root/var/backup directory from there you can download it again & also can rollback if it is needed in future.

Please refer this devdocs.

  • I will check, will let you know Apr 4, 2019 at 7:13
  • Thanks for the answer. +1 Apr 5, 2019 at 5:01

In Adobe cloud, php bin/magento support:backup:db

would output that DB exported successfully and it should be available under var/support

you can use php bin/magento support:backup:db -vvv to get exact file path of export as well if export path is not specified.

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.