当前位置:网站首页>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'@'%';
边栏推荐
猜你喜欢
[AUTOSAR nine c/s principle Architecture]
Test shift right: Elk practice of online quality monitoring
Win10 can't be installed in many ways Problems with NET3.5
MySQL
机器学习术语
How to convert Quanzhi a40i/t3 to can through SPI
RISA rz/g2l processor introduction | frame diagram | power consumption | schematic diagram and hardware design guide
Strongly connected components of digraph
Excel if formula determines whether the two columns are the same
excel去除小数点后面的数据,将数字取整
随机推荐
【FPGA教程案例6】基于vivado核的双口RAM设计与实现
数学建模之线性规划(含MATLAB代码)
信息熵的基础
Deep analysis of data storage in memory
Telephone network problems
关于Fibonacci数列
Rk3568 development board evaluation (II): development environment construction
Specified interval inversion in the linked list
Asynchronous, email and scheduled tasks
全志A40i/T3如何通过SPI转CAN
Assets, vulnerabilities, threats and events of the four elements of safe operation
Leetcode-934: the shortest Bridge
Thank you for being together for these extraordinary two years!
寻找标杆战友 | 百万级实时数据平台,终身免费使用
Find a benchmark comrade in arms | a million level real-time data platform, which can be used for free for life
matlab查找某一行或者某一列在矩阵中的位置
瑞萨电子RZ/G2L开发板上手评测
FPGA - 7系列 FPGA内部结构之Clocking -04- 多区域时钟
[shutter] image component (configure local GIF image resources | load placeholder with local resources)
Appuyez sur l'apprentissage de l'esprit de frappe - reconnaissance des coordonnées de fond multithreadées