当前位置:网站首页>MySQL foundation 07-dcl
MySQL foundation 07-dcl
2022-07-03 01:12:00 【Super brother 1986】
DCL sentence
DCL Statements are mainly DBA Used to manage object permissions in the system , Common developers rarely use . below
Let's briefly explain it with an example .
Create a database user plf, Have right plf Of all the tables in the database SELECT/INSERT jurisdiction :
1. Manage users
1. Add users :
* grammar :CREATE USER ' user name '@' Host name ' IDENTIFIED BY ' password ';
* The host name can be used % Indicates that the user can access the database from any address
2. Delete user :
* grammar :DROP USER ' user name '@' Host name ';
3. Change user password :
UPDATE USER SET PASSWORD = PASSWORD(' New password ') WHERE USER = ' user name ';
UPDATE USER SET PASSWORD = PASSWORD('abc') WHERE USER = 'lisi';
SET PASSWORD FOR ' user name '@' Host name ' = PASSWORD(' New password ');
SET PASSWORD FOR 'root'@'localhost' = PASSWORD('123');
* mysql I forgot root User's password ?
1. cmd -- > net stop mysql stop it mysql service
* The administrator is required to run the cmd
2. Start with no validation mysql service : mysqld --skip-grant-tables
3. Open up new cmd window , Direct input mysql command , Knock back . You can log in successfully
4. use mysql;
5. update user set password = password(' Your new password ') where user = 'root';
6. Close two windows
7. Open Task Manager , Manual end mysqld.exe The process of
8. start-up mysql service
9. Log in with the new password .
4. Query the user :
-- 1. Switch to mysql database
USE myql;
-- 2. Inquire about user surface
SELECT * FROM USER;
notes : wildcard : % Indicates that the user can log in to the database on any host
2. Rights management :
1. Query authority :
-- Query authority
SHOW GRANTS FOR ' user name '@' Host name ';
SHOW GRANTS FOR 'lisi'@'%';
2. Grant authority :
-- Grant authority
grant Permission list on Database name . Table name to ' user name '@' Host name ';
-- Give all permissions to Zhang San , On any table in any database
GRANT ALL ON *.* TO 'zhangsan'@'localhost';
3. Revoke authority :
-- Revoke authority :
revoke Permission list on Database name . Table name from ' user name '@' Host name ';
REVOKE UPDATE ON db3.`account` FROM 'lisi'@'%';
边栏推荐
- Rk3568 development board evaluation (II): development environment construction
- 基于ARM RK3568的红外热成像体温检测系统
- Advanced pointer (I)
- MySQL
- Key wizard play strange learning - front desk and Intranet send background verification code
- Several cases of recursive processing organization
- 正确甄别API、REST API、RESTful API和Web Service之间的异同
- 无向图的割点
- 【FPGA教程案例6】基于vivado核的双口RAM设计与实现
- [C language] branch and loop statements (Part 1)
猜你喜欢

Trois tâches principales: asynchrone, courrier et timing

Strongly connected components of digraph
![[AUTOSAR eight OS]](/img/ac/fbc84c077ff9c94c840e1871171d19.png)
[AUTOSAR eight OS]

瑞萨RZ/G2L ARM开发板存储读写速度与网络实测

Leetcode-2280: represents the minimum number of line segments of a line graph
![[flutter] icons component (fluttericon Download Icon | customize SVG icon to generate TTF font file | use the downloaded TTF icon file)](/img/ca/1d2473ae51c59b84864352eb17de94.jpg)
[flutter] icons component (fluttericon Download Icon | customize SVG icon to generate TTF font file | use the downloaded TTF icon file)

基本远程连接工具Xshell

Asynchronous, email and scheduled tasks

Embrace the safety concept of platform delivery

全志A40i/T3如何通过SPI转CAN
随机推荐
【爱死机】《吉巴罗》被忽略的细节
[AUTOSAR eight OS]
基本远程连接工具Xshell
In the first half of 2022, there are 10 worth seeing, and each sentence can bring you strength!
12_ Implementation of rolling automatic video playback effect of wechat video number of wechat applet
[flutter] icons component (load the built-in icon of flutter | display the material design icon completely)
465. 最优账单平衡 DFS 回溯
leetcode:871. 最低加油次数【以前pat做过 + 最大堆 +贪心】
按鍵精靈打怪學習-多線程後臺坐標識別
MySQL基础用法02
Inversion de l'intervalle spécifié dans la liste des liens
按键精灵打怪学习-自动回城路线的判断
How wide does the dual inline for bread board need?
Matlab finds the position of a row or column in the matrix
电话网络问题
Appuyez sur l'apprentissage de l'esprit de frappe - reconnaissance des coordonnées de fond multithreadées
1038 Recover the Smallest Number
每日一题之干草堆的移动
全志A40i/T3如何通过SPI转CAN
MySQL multi table joint deletion