当前位置:网站首页>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'@'%';
边栏推荐
- tail -f 、tail -F、tailf的区别
- 【FH-GFSK】FH-GFSK信号分析与盲解调研究
- Several cases of recursive processing organization
- 【FPGA教程案例6】基于vivado核的双口RAM设计与实现
- Advanced pointer (I)
- [AUTOSAR twelve mode management]
- [AUTOSAR I overview]
- Thank you for being together for these extraordinary two years!
- On Fibonacci sequence
- Kivy教程大全之 创建您的第一个kivy程序 hello word(教程含源码)
猜你喜欢

Explain the basic concepts and five attributes of RDD in detail

攻克哈希的基本概念与实现

What is needed to develop a domestic arm intelligent edge computing gateway

Lu Zhe, chief scientist of Shiping information: building data and personnel centered security capabilities

全志A40i/T3如何通过SPI转CAN

Merge K sorted linked lists

正确甄别API、REST API、RESTful API和Web Service之间的异同

In the first half of 2022, there are 10 worth seeing, and each sentence can bring you strength!

Advanced pointer (I)
![[shutter] image component (cached_network_image network image caching plug-in)](/img/cc/967ff62c7f82e1c6613b3d0f26bb3e.gif)
[shutter] image component (cached_network_image network image caching plug-in)
随机推荐
(C语言)数据的存储
【C语言】分支和循环语句(上)
matlab将数字矩阵保存为地理空间数据出错,显示下标索引必须为正整数类型或逻辑类型,解决
MySQL
Rk3568 development board evaluation (II): development environment construction
基于ARM RK3568的红外热成像体温检测系统
信息熵的基础
[flutter] icons component (load the built-in icon of flutter | display the material design icon completely)
Inversion de l'intervalle spécifié dans la liste des liens
MySQL multi table joint deletion
465. DFS backtracking of optimal bill balance
[AUTOSAR VI description document]
Find a benchmark comrade in arms | a million level real-time data platform, which can be used for free for life
这不平凡的两年,感谢我们一直在一起!
解决ReactNative使用webView存在缓存问题
Excel if formula determines whether the two columns are the same
The R language uses the ctree function in the party package to build conditional inference decision trees, uses the plot function to visualize the trained conditional inference decision tree, and the
按键精灵打怪学习-前台和内网发送后台验证码
Delete duplicate elements in the ordered linked list -ii
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