当前位置:网站首页>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 ……
边栏推荐
- Determine the Photo Position
- Information security - security professional name | CVE | rce | POC | Vul | 0day
- Penetration testing (5) -- a collection of practical skills of scanning King nmap and penetration testing tools
- 渗透测试 ( 1 ) --- 必备 工具、导航
- 力扣刷题记录--完全背包问题(一)
- China potato slicer market trend report, technical dynamic innovation and market forecast
- 【高老师UML软件建模基础】20级云班课习题答案合集
- Research Report on market supply and demand and strategy of China's land incineration plant industry
- mysql导入数据库报错 [Err] 1273 – Unknown collation: ‘utf8mb4_0900_ai_ci’
- Cost accounting [21]
猜你喜欢
Information security - threat detection - Flink broadcast stream broadcaststate dual stream merging application in filtering security logs
渗透测试 ( 2 ) --- 渗透测试系统、靶机、GoogleHacking、kali工具
Information security - Epic vulnerability log4j vulnerability mechanism and preventive measures
渗透测试 ( 5 ) --- 扫描之王 nmap、渗透测试工具实战技巧合集
Information security - threat detection - detailed design of NAT log access threat detection platform
信息安全-安全编排自动化与响应 (SOAR) 技术解析
用C语言写网页游戏
数据在内存中的存储&载入内存,让程序运行起来
渗透测试 ( 7 ) --- 漏洞扫描工具 Nessus
C语言是低级和高级的分水岭
随机推荐
渗透测试 ( 4 ) --- Meterpreter 命令详解
Ball Dropping
渗透测试 ( 8 ) --- Burp Suite Pro 官方文档
Research Report of peripheral venous catheter (pivc) industry - market status analysis and development prospect prediction
CEP used by Flink
程序员的你,有哪些炫技的代码写法?
Research Report on market supply and demand and strategy of Chinese graphic screen printing equipment industry
Penetration test (3) -- Metasploit framework (MSF)
差分(一维,二维,三维) 蓝桥杯三体攻击
渗透测试 ( 3 ) --- Metasploit Framework ( MSF )
HDU-6025-Coprime Sequence(女生赛)
滲透測試 ( 1 ) --- 必備 工具、導航
Record of brushing questions with force deduction -- complete knapsack problem (I)
动态规划前路径问题
Opencv learning log 12 binarization of Otsu method
Borg Maze (BFS+最小生成树)(解题报告)
Cost accounting [18]
Learning record: use stm32f1 watchdog
Opencv learning log 32 edge extraction
【高老师软件需求分析】20级云班课习题答案合集