In mysql, you can use the REVOKE statement to delete the permissions of a specified user (specified permissions or all permissions). The syntax to cancel all permissions is "REVOKE ALL PRIVILEGES, GRANT OPTION FROM user;". For the REVOKE statement to take effect, you must have the global CREATE USER permission or UPDATE permission of the MySQL database.
The operating environment of this tutorial: windows7 system, mysql8 version, Dell G3 computer.
In MySQL, you can use theREVOKE
statement to delete some or all permissions of a user.
Delete all permissions of a specific user, the syntax format is as follows:
REVOKE ALL PRIVILEGES, GRANT OPTION FROM 用户;
You need to pay attention to the following points when deleting user permissions:
Example:Assume that the rfc user has SELECT, UPDATE, and DELETE permissions on the sample database.
To revoke all permissions from the rfc user, execute the following command:REVOKE ALL PRIVILEGES, GRANT OPTION FROM rfc;If rfc checks the user's permissions again, you will see that the rfc user has no permissions.
SHOW GRANTS FOR rfc; GRANT USAGE ON *.* TO 'rfc'@'%';Note: USAGE permissions means there are no permissions in MySQL.
When the MySQL REVOKE command takes effect
The effect of the MySQL REVOKE statement depends on the permission level, as follows:mysql video tutorial]
The above is the detailed content of How to cancel all permissions in mysql. For more information, please follow other related articles on the PHP Chinese website!