当前位置:网站首页>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'@'%';
边栏推荐
- Cut point of undirected graph
- 【C语言】分支和循环语句(上)
- Leetcode-2115: find all the dishes that can be made from the given raw materials
- Usage of using clause in kingbases alter table
- Find a benchmark comrade in arms | a million level real-time data platform, which can be used for free for life
- 12_微信小程序之微信视频号滚动自动播放视频效果实现
- Assets, vulnerabilities, threats and events of the four elements of safe operation
- 18_微信小程序之微信视频号滚动自动播放视频效果实现2.0
- Lu Zhe, chief scientist of Shiping information: building data and personnel centered security capabilities
- JS inheritance and prototype chain
猜你喜欢

MySQL basic usage 02

1696C. Fishingprince Plays With Array【思维题 + 中间状态 + 优化存储】

RK3568开发板评测篇(二):开发环境搭建

基本远程连接工具Xshell
![[case sharing] let the development of education in the new era advance with](/img/11/af88d16dc66f00840cbfc5ba5d68bd.jpg)
[case sharing] let the development of education in the new era advance with "number"
![[AUTOSAR XIII NVM]](/img/38/805ab70f199e2cfad4d9dae0e2c1ff.png)
[AUTOSAR XIII NVM]
![[overview of AUTOSAR four BSW]](/img/19/c2273bbedb7f8d859e5a3805ed5740.png)
[overview of AUTOSAR four BSW]

Leetcode-849: maximum distance to the nearest person

MySQL基础用法02
![1696C. Fishingprince plays with array [thinking questions + intermediate state + optimized storage]](/img/bf/ab6838e34a3074130eac0a9992e77c.png)
1696C. Fishingprince plays with array [thinking questions + intermediate state + optimized storage]
随机推荐
Leetcode-224: basic calculator
Leetcode-2280: represents the minimum number of line segments of a line graph
Specified interval inversion in the linked list
按键精灵打怪学习-自动回城路线的判断
【无标题】
攻克哈希的基本概念与实现
[AUTOSAR five methodology]
MySQL
瑞萨RZ/G2L 处理器简介|框架图|功耗|原理图及硬件设计指南
Trois tâches principales: asynchrone, courrier et timing
电话网络问题
合并K个已排序的链表
Key wizard hit strange learning - automatic path finding back to hit strange points
KingbaseES ALTER TABLE 中 USING 子句的用法
MongoDB系列之MongoDB常用命令
Advanced pointer (I)
How to systematically learn machine learning
excel表格计算时间日期的差值,并转化为分钟数
In the first half of 2022, there are 10 worth seeing, and each sentence can bring you strength!
RISA rz/g2l processor introduction | frame diagram | power consumption | schematic diagram and hardware design guide