当前位置:网站首页>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'@'%';
边栏推荐
- Meaning of Tencent cloud free SSL certificate extension file
- Appuyez sur l'apprentissage de l'esprit de frappe - reconnaissance des coordonnées de fond multithreadées
- 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
- matlab查找某一行或者某一列在矩阵中的位置
- 按键精灵打怪学习-多线程后台坐标识别
- 合并K个已排序的链表
- excel表格计算时间日期的差值,并转化为分钟数
- 寻找标杆战友 | 百万级实时数据平台,终身免费使用
- On Fibonacci sequence
- 【无标题】
猜你喜欢
安全运营四要素之资产、脆弱性、威胁和事件
tail -f 、tail -F、tailf的区别
【FH-GFSK】FH-GFSK信号分析与盲解调研究
Rk3568 development board evaluation (II): development environment construction
飞凌搭载TI AM62x的ARM核心板/开发板首发上市,亮相Embedded World 2022
Data analysis, thinking, law breaking and professional knowledge -- analysis method (I)
Linear programming of mathematical modeling (including Matlab code)
(C语言)数据的存储
无向图的割点
[AUTOSAR I overview]
随机推荐
R language generalized linear model function GLM, (model fit and expression diagnostics), model adequacy evaluation method, use plot function and car package function
Matlab Doppler effect produces vibration signal and processing
MySQL基础用法02
Specified interval inversion in the linked list
Several cases of recursive processing organization
mysql 多表联合删除
详解RDD基本概念、RDD五大属性
安全运营四要素之资产、脆弱性、威胁和事件
[flutter] icons component (fluttericon Download Icon | customize SVG icon to generate TTF font file | use the downloaded TTF icon file)
leetcode:871. Minimum refueling times [Pat has done before + maximum stacking + greed]
Explain the basic concepts and five attributes of RDD in detail
【FPGA教程案例6】基于vivado核的双口RAM设计与实现
Foundations of data science is free to download
Leetcode-1964: find the longest effective obstacle race route to each position
Test shift right: Elk practice of online quality monitoring
关于Fibonacci数列
[AUTOSAR five methodology]
Leetcode-849: maximum distance to the nearest person
R language uses coin package to apply permutation tests to independence problems (permutation tests, whether response variables are independent of groups, are two numerical variables independent, and
瑞萨RZ/G2L 处理器简介|框架图|功耗|原理图及硬件设计指南