I have MySQL 8 database with a user to whom I grant ALL privileges as follows:
GRANT ALL ON test_db.* TO 'test_user'@'%';
When I login to mysql as this user and run the following command I get error saying ERROR 1227 (42000): Access denied; you need (at least one of) the RELOAD or FLUSH_TABLES privilege(s) for this operation
FLUSH TABLES;
I thought the GRANT ALL permission would have already given this user the RELOAD or FLUSH_TABLES privilege(s)?
How do I fix?
1 Answer 1
Global privileges are administrative or apply to all databases on a given server. To assign global privileges, use ON . syntax.
The CREATE TABLESPACE, CREATE USER, FILE, PROCESS, RELOAD, REPLICATION CLIENT, REPLICATION SLAVE, SHOW DATABASES, SHUTDOWN, and SUPER static privileges are administrative and can only be granted globally.
The RELOAD enables the following operations:
- Use of the FLUSH statement.
- etc
Conclusion , you need the reload privilege which can be given :
GRANT RELOAD ON *.* TO 'test_user'@'%';
-
so what you are saying is I'd have to give it as a global privilege as opposed to being able to restrict to a specific database?adam78– adam782023年03月03日 14:23:58 +00:00Commented Mar 3, 2023 at 14:23
-
@adam78 yes, global privileges apply to all databases, you can't restrict to only one specific db.Ergest Basha– Ergest Basha2023年03月03日 14:28:36 +00:00Commented Mar 3, 2023 at 14:28