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 permissions
Category 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
Parameter description

Symbol Description grant all Follow grant with all instructions to grant all permissions revoke all After revoke, follow all instructions to delete all permissions Permissions 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
||
submit Reset Code
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!