mysql 混合权限
我正在尝试为包含“只读”表和“读写”表的数据库创建一组单独的权限。更具体地说,数据库包含 10 个表,我希望用户只能读取这些表(即仅选择)。它还包含大约 30 个表,用户可以自由地读写这些表。最后,我还希望用户能够创建/删除/更改他创建的表,从而授予他对同一数据库下自己的表的完全访问权限。
这样的事情可能吗?我试图思考如何使用 GRANT,但我的头被卡住了。
谢谢
I am trying to create a separate set of privileges for a database that contains both "read only" tables and "read write" tables. To be more specific, the database contains 10 tables that I want the user to only read from (i.e. select only). It also contains around 30 tables which the user is free to read and write to and from. Lastly, I would also like the user to be able to create/drop/alter tables created by him thus granting him full access to his own tables under the same database.
Is something like this possible? I have tried to think of the ways I can use GRANT but my head is getting stuck.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你想要的都是可能的,除了我不确定最后一句话。我不认为 mySQL 表有“所有者”,但您可以限制对具有某些前缀的表的访问。也许这是一条路。
强制性手册参考:12.4.1.3。 GRANT 语法
我建议使用像 HeidiSQL (适用于 Windows)这样的 GUI 来进行指向和-单击所需的权限规则。它还会生成正确的 SQL 供查看和学习。 这里是其出色的用户管理器的屏幕截图。
What you want is possible except I'm not sure about the last sentence. I don't think mySQL tables have "owners" as such, but you can limit access to tables with certain prefixes. Maybe that is a way to go.
Obligatory manual reference: 12.4.1.3. GRANT Syntax
I recommend using a GUI like HeidiSQL (for Windows) to point-and-click the required privilege rules. It produces proper SQL to look at and learn from as well. Here is a screen shot of its excellent user manager.