DCL statement
Create library user
Add permissions
## Example grant select, insert on test.* to 'liwenkai'@'localhost' identified by '4311'; Example description Give The liwenkai user has the authority to connect to all tables in the test library locally. These tables operated have query and write permissionsCategory | Detailed explanation |
---|---|
Basic syntax | grant permission on library.table to 'user'@'host' identified by 'password'; |
Note: Multiple permissions can be added to a user.Delete permission Category Detailed explanation Basic syntax revoke permission on library.table from 'user'@'host'; Example revoke select, insert on test.* to 'liwenkai'@'localhost' identified by '4311'; Example description Give liwenkai user, connect all tables of the test library locally permission. These tables operated have query and write permissions
. | .As stated Grant operation permissions to all tables in all libraries |
Example: Increase permissions
mysql> grant select, insert on test.* to 'liwenkai'@'localhost' identified by '4311';Query OK, 0 rows affected (0.00 sec)
Example: Remove permission
##mysql> revoke insert on test.* from 'liwenkai '@'localhost';Query OK, 0 rows affected (0.30 sec)Note:
Some of the above statements are rarely used. You can set the mastery level of knowledge points to the understanding level.
More often, there are so many permission setting items that people often cannot remember specific commands. More often than not, people use specialized tools to manipulate permissions.