acsf-tools icon indicating copy to clipboard operation
acsf-tools copied to clipboard

mysql dump failing with PROCESS privilege permissions failure

Open alex-moreno opened this issue 3 years ago • 3 comments

See: https://github.com/drush-ops/drush/issues/4489

> mysqldump: Error: 'Access denied; you need (at least one of) the PROCESS privilege(s) for this operation' when trying to dump tablespaces

Other projects seem to fix it in a similar way (just adding the flag): https://github.com/massgov/openmass/pull/646/files

Cloud IDE has solved it in a different way, granting permissions, but that may not be suitable for everyone as per security concerns: https://github.com/acquia/ads-remote-ide-proxy/pull/381/files

More information:

  • https://drupal.stackexchange.com/questions/300321/what-is-the-significance-of-dumping-the-tablespaces
  • https://backlog.acquia.com/browse/CL-49217?jql=text%20~%20%22drush%20sql-dump%20process%20privilege%22

alex-moreno avatar Apr 06 '21 08:04 alex-moreno

As per the code of acsf-tools-dump, it looks like it is passing all the options to sql-dump

// Get options passed to this drush command & append it with options
// needed by the next command to execute.
$options = Drush::redispatchOptions();
unset($options['php']);
unset($options['php-options']);
unset($options['result-folder']);

$options['result-file'] = $backup_result_folder . '/' . $details['machine_name'] . '.sql';
$options['uri'] = $domain;

$this->output()->writeln("=> Taking database dump of {$details['machine_name']} ...");
$self = $this->siteAliasManager()->getSelf();
// Remove empty values from array.
$options = array_filter($options);
$process = Drush::drush($self, $command, $arguments, $options);

I think executing drush acsf-tools-dump --result-folder=/tmp --no-tablespaces --gzip should work.

If that is the case, we should probably remove the explicit mention to --gzip and instead mention that all options except --result-folder (--result-file which is dynamically calculated) are given to the drush sql-dump command.

vbouchet31 avatar Apr 14 '21 07:04 vbouchet31

@vbouchet31 Probably you are right, but this option should be allowed in the command annotation first.

   * @command acsf-tools:dump
   *
   * @bootstrap site
   * @param array $options An associative array of options whose values come from cli, aliases, config, etc.
   * @option result-folder
   *   The folder in which the dumps will be written. Defaults to ~/drush-backups.
   * @option gzip
   *   Compress the dump into a zip file.
   *

Hi @andrii-aleksandrov-smile

I think it is a "recent" change with drush. On previous (not sure which previous ;-) ), drush was accepting arbitrary options. Now I suspect it is either breaking or stripping unknown options.

My suggestion instead of allowing explicit options (--no-tablespaces for example) would be to add a specific option for which the values would be passed to sql-dump command.

drush acsf-tools-dump --sql-dump-extra="--extra=--no-tablespaces --another-option"

I won't have time to work on this soon but if you feel the suggestion is the proper approach, patch is welcome.

cc @sdelbosc (for the approach) cc @tguilpain

vbouchet31 avatar Jul 01 '21 08:07 vbouchet31