If there is any single privilege that denotes ALL READ operations in the database.
It depends on how you define "all read."
Reading from tables and views is a SELECT privilege. If this is what you mean by βall read,β then yes:
GRANT SELECT ON *.* TO 'username'@'host_or_wildcard' IDENTIFIED BY 'password';
However, it seems that you mean the ability to "see" everything, "look, but not touch." So, here are other types of reading that come to mind:
Reading the definition of views is a SHOW VIEW privilege.
"Reading" the list of queries currently being executed by other users is a PROCESS privilege.
Reading the current state of replication is a REPLICATION CLIENT privilege.
Please note that any or all of them may display more information than you intend to exhibit, depending on the nature of the user.
If you want to do this reading, you can combine any of them (or any other privileges available ) in one GRANT .
GRANT SELECT, SHOW VIEW, PROCESS, REPLICATION CLIENT ON *.* TO ...
However, there is no single privilege that provides a subset of the other privileges, which is similar to what you are asking for.
If you are doing something manually and looking for an easier way around this without having to remember the exact grant that you usually make for a particular class of users, you can find an expression to restore comparable user grants and modify it to create a new user with similar privileges:
mysql> SHOW GRANTS FOR 'not_leet'@'localhost'; +------------------------------------------------------------------------------------------------------------------------------------+ | Grants for not_leet@localhost | +------------------------------------------------------------------------------------------------------------------------------------+ | GRANT SELECT, REPLICATION CLIENT ON *.* TO 'not_leet'@'localhost' IDENTIFIED BY PASSWORD '*xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' | +------------------------------------------------------------------------------------------------------------------------------------+ 1 row in set (0.00 sec)
Changing "not_leet" and "localhost" to match the new user that you want to add along with the password will reuse the GRANT statement to create a new user.
Of, if you want a single operation to configure and provide a limited set of privileges for users and possibly delete any undeserved privileges, this can be done by creating a stored procedure that encapsulates everything that you want to do. Inside the procedure procedure, you must build a GRANT statement with dynamic SQL and / or directly manipulate the grant tables themselves.
In this recent question about database administrators, the poster wanted the unprivileged user to be able to modify other users, which, of course, is not something that can usually be done - a user who can modify other users, to a large extent by definition, but not a non-privileged user - however - a stored procedure provided a good solution in this case, because they are carried out with the security context of the user DEFINER , which allows anyone with a privilege EXECUTE in the proce Ur to temporarily take escalated privileges, allowing them to carry out specific actions to be performed the procedure.