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
1. Nexus configuration 1. Create a docker proxy U...
Table of contents 1. Introduction 2. Thought Anal...
In the UI cutting process, the page is often comp...
Table of contents first step: The second step is ...
In react, if you modify the state directly using ...
1: Download MySql Official website download addre...
1. Cancel the dotted box when the button is press...
Table of contents background Inspiration comes fr...
Log rotation is a very common function on Linux s...
Preface After reading the previous article about ...
The common way to deploy a springboot project to ...
The docker exec command can execute commands in a...
Three MySQL instance processes are started on one...
Stored Functions What is a stored function: It en...
Div solution when relative width and absolute wid...