flush tables - access denied

2019-06-16 06:01发布

问题:

I need to back my database, but when trying to flush the tables before backing up I get this error? What does it mean by RELOAD privilege?

Can't find any RELOAD privilege in phpmyadmin!?

Error: Access denied; you need the RELOAD privilege for this operation
SQL: FLUSH TABLES WITH READ LOCK

回答1:

Probably you're not running FLUSH command using root, but with a limited user.
You need to be granted RELOAD privilege to run FLUSH command.
Take a look here for MySQL privileges.
So (for example) root user should use:

GRANT RELOAD ON *.* TO 'your_user'@'localhost';


回答2:

To clarify:
RELOAD can only be granted globally, not to a particular database. Need to use *.*

GRANT RELOAD ON *.* TO 'your_user'@'localhost';

From the MySQL docs: GRANT Syntax - Global Privileges

The CREATE USER, FILE, PROCESS, RELOAD, REPLICATION CLIENT, REPLICATION SLAVE, SHOW DATABASES, SHUTDOWN, and SUPER privileges are administrative and can only be granted globally.