当前位置:网站首页>MySQL grants the user the operation permission of the specified content
MySQL grants the user the operation permission of the specified content
2022-07-06 15:57:00 【Flame car】
Grant users a library 、 The permissions of a table or a column can be easily found (GRANT), But there is a problem: how to grant the user the operation permission of the specified content ??
A problem of database experiment :
Suppose a user is CS Department managers , The authority that needs to be given to him only includes adding, deleting, checking and modifying the information of the computer department teacher , How to achieve ?
At first, I thought it was the same as specifying a column , Nothing more than specifying a certain line . Then Baidu spent a long time and found that it didn't say what to do at all ? Then it's time to go to bed , Suddenly thought of whether to re create a table and specify the rows of the things on that table ( Department of Computer Science ) Let it go ?
Come here , I suddenly remembered that one of the videos given by the teacher was view operation ( Why didn't I see it ???), I wonder if I should map the table to the view first , Then give the permission of the view to the user ? Then I checked again , You can modify the original table by modifying the view , That is to say, it really does .
summary : The user is not directly authorized to operate the specified content GRANT, You need to create a view through conditions and then grant users the operation permission of the view to achieve this effect .
Specific operation :
CREATE VIEW cs_instructor AS
SELECT *
FROM instructor
WHERE dept_name = 'Comp. Sci.'
Create a view , Inside is the information of the computer department teacher .
GRAND SELECT ON cs_instructor TO 'name'@'localhost';
In this way, the permission is granted to the user ,TO The following single quotation mark can be added or not .
Then you may have to modify the permissions of the view , hold Definer Change it to Invoker, But I don't know why I use it instead Definer To open ……
边栏推荐
- Opencv learning log 16 paperclip count
- X-Forwarded-For详解、如何获取到客户端IP
- 渗透测试 ( 8 ) --- Burp Suite Pro 官方文档
- Learning records: serial communication and solutions to errors encountered
- Cost accounting [18]
- 通俗地理解什么是编程语言
- Accounting regulations and professional ethics [4]
- Accounting regulations and professional ethics [1]
- HDU - 6024 Building Shops(女生赛)
- MySQL import database error [err] 1273 - unknown collation: 'utf8mb4_ 0900_ ai_ ci’
猜你喜欢
X-forwarded-for details, how to get the client IP
【高老师软件需求分析】20级云班课习题答案合集
Penetration test (3) -- Metasploit framework (MSF)
用C语言写网页游戏
STM32 learning record: LED light flashes (register version)
STM32 how to use stlink download program: light LED running light (Library version)
力扣刷题记录
MATLAB综合练习:信号与系统中的应用
Learning record: Tim - Basic timer
Matlab comprehensive exercise: application in signal and system
随机推荐
【练习-2】(Uva 712) S-Trees (S树)
Web based photo digital printing website
【练习-11】4 Values whose Sum is 0(和为0的4个值)
Cost accounting [21]
Flink 使用之 CEP
区间和------离散化
China's earthwork equipment market trend report, technical dynamic innovation and market forecast
信息安全-安全编排自动化与响应 (SOAR) 技术解析
China's PCB connector market trend report, technological innovation and market forecast
Essai de pénétration (1) - - outils nécessaires, navigation
Penetration testing (5) -- a collection of practical skills of scanning King nmap and penetration testing tools
C 基本语法
X-Forwarded-For详解、如何获取到客户端IP
Cost accounting [24]
信息安全-史诗级漏洞Log4j的漏洞机理和防范措施
渗透测试 2 --- XSS、CSRF、文件上传、文件包含、反序列化漏洞
C语言是低级和高级的分水岭
渗透测试 ( 3 ) --- Metasploit Framework ( MSF )
B - 代码派对(女生赛)
Research Report of peripheral venous catheter (pivc) industry - market status analysis and development prospect prediction