DCL statement
Create library user
Add permissions
Category | Detailed explanation |
---|---|
Basic syntax | grant permission on library.table to 'user'@'host' identified by 'password'; |
grant select, insert on test.* to 'liwenkai'@'localhost' identified by '4311'; | |
Give The liwenkai user has the authority to connect to all tables in the test library locally. These tables operated have query and write permissions |
Note: Multiple permissions can be added to a user.Delete permission
Detailed explanation | |
---|---|
revoke permission on library.table from 'user'@'host'; | |
revoke select, insert on test.* to 'liwenkai'@'localhost' identified by '4311'; | |
Give liwenkai user, connect all tables of the test library locally permission. These tables operated have query and write permissions |
Description | |
---|---|
Follow grant with all instructions to grant all permissions | |
After revoke, follow all instructions to delete all permissions | |
. | . As stated Grant operation permissions to all tables in all libraries |
If the host is %. Hosts from any source can use this user to access |
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.