DCL statement

Create library user

Add permissions

## Examplegrant select, insert on test.* to 'liwenkai'@'localhost' identified by '4311';Example descriptionGive The liwenkai user has the authority to connect to all tables in the test library locally. These tables operated have query and write permissions
CategoryDetailed explanation
Basic syntaxgrant permission on library.table to 'user'@'host' identified by 'password';
Note: Multiple permissions can be added to a user.

Delete permission

CategoryDetailed explanationBasic syntaxrevoke permission on library.table from 'user'@'host';Examplerevoke select, insert on test.* to 'liwenkai'@'localhost' identified by '4311';Example descriptionGive liwenkai user, connect all tables of the test library locally permission. These tables operated have query and write permissions
Parameter description

SymbolDescription grant all Follow grant with all instructions to grant all permissionsrevoke allAfter revoke, follow all instructions to delete all permissionsPermissions on 'User'@'Host'If the host is %. Hosts from any source can use this user to access
.. As stated Grant operation permissions to all tables in all libraries
Create database user liwenkai, with select/insert permissions on all targets in the test database

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.

Continuing Learning
||
submitReset Code