授予用户权限以仅查看mysql视图 [英] Grant a user permission to only view a mysql view
问题描述
以下问题与MySQL 5.1.44有关
The below question pertains to MySQL 5.1.44
比方说,我有一个表,其中包含应用程序的不同用户插入的记录.如何授予特定用户访问权限,使其仅查看该表中的记录?我曾考虑过用他/她的记录创建一个VIEW
,但是我不知道如何创建一个只能看到VIEW
的mysql用户.
Let's say I have a table with records inserted by different users of my application. How can I give a specific user access to only see his/her records in that table? I've thought about creating a VIEW
with his/her records, but I don't know how to create a mysql user that can only see that VIEW
.
那么,有可能创建一个只能访问单个VIEW
的mysql用户吗?也可以使该用户成为只读用户对该VIEW
的访问者吗?
So, is it possible to create a mysql-user that only has access to a single VIEW
? can this user also be made so they read-only access to that VIEW
?
谢谢!
PS:在我的示例中,我所说的 users 实际上是希望通过自己的应用程序访问其记录的子公司.
PS: What I call users in my example are really subsidiary offices that want to access their records with their own applications.
推荐答案
GRANT SELECT ON database1.view1 TO 'someuser'@'somehost';
这篇关于授予用户权限以仅查看mysql视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!