# # Part1: Authorization # Authorization is granting certain permissions to a user. # example 1: Grant the test user the SELECT permission on all tables of the ABC library. GRANT SELECT on ' abc '. * to ' test ' @ ' localhost '; # example 2: Grant test users all permissions (including grant permissions) for all tables in all libraries. GRANT all privileges on * * to ' test ' @ ' localhost ' with GRANT OPTION;
# # Part2: Reclaim permissions # Revoke a permission is a certain permission to cancel a user. # example 1: Recover the SELECT permission of the test user. REVOKE SELECT on * * from ' test ' @ ' localhost '; # example 2: Retract all the permissions of the test user (including grant permissions). REVOKE all privileges, GRANT OPTION on * * from ' test ' @ ' localhost ';
# # Part3: Viewing permissions # There are two ways to view permissions, one is to view the Mysql.user table directly, and the other is to view it through the show grants statement. # example 1: Get the [email protected] permission by viewing the Mysql.user table. SELECT * from ' MySQL '. ' User ' WHERE ' user ' = ' root ' and ' Host ' = ' localhost '; # example 2: View the current user's permissions through the show grants statement. Show grants;# Example 3: View the permissions of the test user through the show GRANTS statement. SHOW GRANTS for ' test ' @ ' localhost ';
This article is from the "Last Night Stars" blog, please make sure to keep this source http://yestreenstars.blog.51cto.com/1836303/1682529
MySQL Rights Management