当前位置:网站首页>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'@'%';
边栏推荐
- First hand evaluation of Reza electronics rz/g2l development board
- Lu Zhe, chief scientist of Shiping information: building data and personnel centered security capabilities
- What is needed to develop a domestic arm intelligent edge computing gateway
- [AUTOSAR eight OS]
- Cut point of undirected graph
- Leetcode-934: the shortest Bridge
- (C language) data storage
- 异步、郵件、定時三大任務
- [shutter] animation animation (shutter animation type | the core class of shutter animation)
- leetcode:701. 二叉搜索树中的插入操作【bst的插入】
猜你喜欢
随机推荐
Mongodb common commands of mongodb series
Find a benchmark comrade in arms | a million level real-time data platform, which can be used for free for life
1038 Recover the Smallest Number
【爱死机】《吉巴罗》被忽略的细节
Specified interval inversion in the linked list
[flutter] icons component (fluttericon Download Icon | customize SVG icon to generate TTF font file | use the downloaded TTF icon file)
[overview of AUTOSAR three RTE]
FPGA - 7 Series FPGA internal structure clocking -04- multi area clock
[case sharing] let the development of education in the new era advance with "number"
Key wizard hit strange learning - automatic path finding back to hit strange points
matlab将数字矩阵保存为地理空间数据出错,显示下标索引必须为正整数类型或逻辑类型,解决
Compare version number
18_ The wechat video number of wechat applet scrolls and automatically plays the video effect to achieve 2.0
MongoDB系列之MongoDB常用命令
RISA rz/g2l processor introduction | frame diagram | power consumption | schematic diagram and hardware design guide
[introduction to AUTOSAR seven tool chain]
Leetcode-1964: find the longest effective obstacle race route to each position
Matlab saves the digital matrix as geospatial data, and the display subscript index must be of positive integer type or logical type. Solve the problem
leetcode:701. 二叉搜索树中的插入操作【bst的插入】
1696C. Fishingprince Plays With Array【思维题 + 中间状态 + 优化存储】



![[love crash] neglected details of gibaro](/img/d6/baa4b5185ddaf88f3df71a94a87ee2.jpg)
![[AUTOSAR nine c/s principle Architecture]](/img/59/ce32c0ff58ef5d8385fe950136175b.png)


![[introduction to AUTOSAR seven tool chain]](/img/cf/ed0ccf39d38e0b4fc3d97d4fd58a7e.png)

