当前位置:网站首页>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 ……
边栏推荐
- MySQL import database error [err] 1273 - unknown collation: 'utf8mb4_ 0900_ ai_ ci’
- 1010 things that college students majoring in it must do before graduation
- Web based photo digital printing website
- 【练习-10】 Unread Messages(未读消息)
- Research Report on market supply and demand and strategy of Chinese graphic screen printing equipment industry
- 【练习4-1】Cake Distribution(分配蛋糕)
- Flink 使用之 CEP
- 区间和------离散化
- X-Forwarded-For详解、如何获取到客户端IP
- Opencv learning log 15 count the number of solder joints and output
猜你喜欢
Borg Maze (BFS+最小生成树)(解题报告)
X-forwarded-for details, how to get the client IP
STM32 learning record: LED light flashes (register version)
渗透测试 ( 7 ) --- 漏洞扫描工具 Nessus
Penetration test (1) -- necessary tools, navigation
Information security - threat detection engine - common rule engine base performance comparison
Web based photo digital printing website
Information security - threat detection - Flink broadcast stream broadcaststate dual stream merging application in filtering security logs
C语言是低级和高级的分水岭
Ball Dropping
随机推荐
Printing quality inspection and verification system Industry Research Report - market status analysis and development prospect forecast
信息安全-安全专业名称|CVE|RCE|POC|VUL|0DAY
Opencv learning log 30 -- histogram equalization
0-1 knapsack problem (I)
Opencv learning log 15 count the number of solder joints and output
Research Report on surgical fluid treatment industry - market status analysis and development prospect prediction
HDU - 6024 Building Shops(女生赛)
Information security - threat detection - detailed design of NAT log access threat detection platform
Learning records: serial communication and solutions to errors encountered
TCP的三次握手与四次挥手
Truck History
0-1背包问题(一)
Penetration test (1) -- necessary tools, navigation
Record of brushing questions with force deduction -- complete knapsack problem (I)
入门C语言基础问答
Learning record: Tim - Basic timer
信息安全-威胁检测-NAT日志接入威胁检测平台详细设计
【练习-4】(Uva 11988)Broken Keyboard(破损的键盘) ==(链表)
Cost accounting [15]
Path problem before dynamic planning