DCL (Data Control Language): Data control language, used to define database access rights and security levels, and to create users. 1. Manage Users 1. Create a user -- Create a user CREATE USER 'username'@'hostname' IDENTIFIED BY 'password'; CREATE USER 'Summerday'@'localhost' IDENTIFIED BY '123456'; ps: If 2. Modify user -- Change password SET PASSWORD FOR 'user name'@'host name' = PASSWORD('new password'); SET PASSWORD FOR 'Summerday'@'localhost' = PASSWORD('hyh123'); 3. Query users -- 1. Switch to mysql database USE mysql; -- 2. Query the user table SELECT * FROM USER; The % wildcard matches everything. 4. Delete User -- Delete user DROP USER 'username'@'hostname'; DROP USER 'Summerday'@'localhost'; 2. Permission Management 1. Query permissions -- Query permissions SHOW GRANTS FOR 'user name'@'host name'; SHOW GRANTS FOR 'Summerday'@'localhost'; 2. Grant permissions -- Grant permissions GRANT permission list ON database name. table name TO 'user name'@'host name'; GRANT SELECT ON mydb2.account TO 'Summerday'@'localhost'; -- Grant all permissions GRANT ALL ON *.* TO 'Summerday'@'localhost'; 3. Revoke permissions -- Revoke permissions REVOKE permission list ON database name. table name FROM 'user name'@'host name'; REVOKE SELECT ON mydb2.account TO 'Summerday'@'localhost'; -- Revoke all permissions REVOKE ALL ON *.* FROM 'Summerday'@'localhost';
The above is the details of how MySQL uses DCL to manage users and control permissions. For more information about MySQL management users and control permissions, please pay attention to other related articles on 123WORDPRESS.COM! You may also be interested in:
|
<<: How to install mysql in docker
>>: An article to help you learn more about JavaScript arrays
Table of contents 1. What is an index signature? ...
1. Overflow content overflow settings (set whether...
The solution to the problem that Ubuntu 18.04 in ...
Let's talk about some problems I have encounte...
Preface Many web applications store data in a rel...
Table of contents 1. Pull the image 2. Create a l...
Description: Change the carriage return in the tex...
Includes the process of initializing the root use...
clear:both is used to清除浮動This is the impression I...
Table of contents 1. Principle of animation funct...
Export: docker save -o centos.tar centos:latest #...
The detailed installation and configuration of th...
1. Environment: CentOS7, Openssl1.1.1k. 2. Concep...
Basic three-column layout .container{ display: fl...
Preface Transactional data dictionary and atomic ...