On Cloud Platform, certain MySQL versions require specific permissions to execute data dumps. Insufficient MySQL permissions result in the failure of the following commands and any scripts or cron jobs that depend on them with a FLUSH TABLES error:
drush sql-dumpdrush sql-syncmysqldumpThe following is an example of an error.
mysqldump: Couldn't execute 'FLUSH TABLES': Access denied; you need (at least one of) the RELOAD privilege(s) for this operation (1227)On Cloud Platform, database users are not granted the RELOAD privilege required for FLUSH TABLES. This restriction does not impact Cloud Classic environments.
To bypass the FLUSH TABLES and tablespace privilege checks during database exports, pass the following flags to your command:
--set-gtid-purged=OFF --no-tablespacesPass the extra flags using the --extra-dump option. This works with both the drush sql-dump and sql-sync commands:
Export a database dump:
drush --uri=mysite.editme.com sql:dump --extra-dump="--set-gtid-purged=OFF --no-tablespaces" > /destination/folder/dump.sqlSync a database:
drush sql:sync @dev @self --extra-dump="--set-gtid-purged=OFF --no-tablespaces"For related permission errors, visit Troubleshooting "ERROR 1227 (42000) at line 18: Access denied".
Pass the extra parameters directly to the mysqldump command:
mysqldump MYDBNAMEHERE --no-tablespaces --set-gtid-purged=OFF > /destination/folder/dump.sql