当前位置:网站首页>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'@'%';
边栏推荐
- Specified interval inversion in the linked list
- MongoDB系列之MongoDB常用命令
- Lu Zhe, chief scientist of Shiping information: building data and personnel centered security capabilities
- 1696C. Fishingprince plays with array [thinking questions + intermediate state + optimized storage]
- [shutter] animation animation (shutter animation type | the core class of shutter animation)
- ROS2之ESP32简单速度消息测试(极限频率)
- Key wizard play strange learning - multithreaded background coordinate recognition
- leetcode:701. 二叉搜索树中的插入操作【bst的插入】
- [introduction to AUTOSAR seven tool chain]
- R language ggplot2 visual faceting, visual facet_wrap bar plot, using strip Text function customize the size of the strip of each facet title in the facet graph (cutimi
猜你喜欢
Draw love with go+ to express love to her beloved
Correctly distinguish the similarities and differences among API, rest API, restful API and web service
Assets, vulnerabilities, threats and events of the four elements of safe operation
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
Excel calculates the difference between time and date and converts it into minutes
用Go+绘制爱心给心爱的她表白
ROS2之ESP32简单速度消息测试(极限频率)
The difference between tail -f, tail -f and tail
Telephone network problems
机器学习术语
随机推荐
每日一题之干草堆的移动
按键精灵打怪学习-前台和内网发送后台验证码
Specified interval inversion in the linked list
飞凌搭载TI AM62x的ARM核心板/开发板首发上市,亮相Embedded World 2022
Compare version number
Leetcode-849: maximum distance to the nearest person
Trois tâches principales: asynchrone, courrier et timing
Leetcode-224: basic calculator
Kivy教程大全之 创建您的第一个kivy程序 hello word(教程含源码)
Thank you for being together for these extraordinary two years!
(C language) data storage
18_微信小程序之微信视频号滚动自动播放视频效果实现2.0
RK3568开发板评测篇(二):开发环境搭建
465. 最优账单平衡 DFS 回溯
1038 Recover the Smallest Number
Usage of using clause in kingbases alter table
[AUTOSAR nine c/s principle Architecture]
leetcode:701. Insertion in binary search tree [BST insertion]
MySQL
2022.2.14 resumption