MySQL How to fix mysqldump: Couldn't execute 'FLUSH TABLES': Access denied
MySQL has released an update for mysqldump which causes backups to fail when mysqldump is executed with the flag
--single-transaction
. The update was released as a minor patch and systems with automatic updates turned on fetched it.
The error message returned when attempting to create a backup using the flag --single-transaction is the following:
There are two solutions at the moment: granting READ and PROCESS permissions to the user executing the backup (recommended) or not using the --single-transaction option (not recommended).
In case you need a list with your users and their hosts, you can run the following query:
The error message returned when attempting to create a backup using the flag --single-transaction is the following:
mysqldump: Couldn't execute 'FLUSH TABLES': Access denied
There are two solutions at the moment: granting READ and PROCESS permissions to the user executing the backup (recommended) or not using the --single-transaction option (not recommended).
First solution: grant RELOAD & PROCESS privileges (recommended)
This is the recommended solution. You need to run the following two commands in order to grant the privileges:# Replace my-user with your user and make sure the host matches the user host
GRANT RELOAD, PROCESS ON *.* TO 'my-user'@'%';
# Reload the privileges
FLUSH PRIVILEGES;
In case you need a list with your users and their hosts, you can run the following query:
SELECT `User`, `HOST`, `Process_priv`, `Reload_priv` FROM mysql.user;
Second solution: don't use the --single-transaction flag
This solution is simpler but should be avoided if possible. Running mysqldump without the --single-transaction flag can be problematic because it can result in an inconsistent backup.Looking for a backup solution? Try Weap.io
Simple & flexible backup solution to keep your servers, websites & databases safe.
Start free trial