简体   繁体   English

"Mysql 授权仅限于一天中的特定时间"

[英]Mysql grant restricted to specific hours of a day

I'd like to know if it is possible in mysql to grant select permission to user but only within specific hours of a day.我想知道是否可以在 mysql 中向用户授予选择权限,但只能在一天的特定时间内。

I have created several views and new user and want to let them browse those mysql views only (for example) between 10pm and 11pm.我已经创建了几个视图和新用户,并希望让他们仅在晚上 10 点到晚上 11 点之间(例如)浏览这些 mysql 视图。

Edit the view criteria to be:将视图标准编辑为:

WHERE ... (previous criteria)
AND (CURRENT_USER() != 'bob@%' OR CURTIME() BETWEEN '22:00' AND '23:00')

This restricts the bob user on these times, otherwise no results are returned in the view.这会在这些时间限制bob用户,否则视图中不会返回任何结果。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM