• <legend id='z1L13'><style id='z1L13'><dir id='z1L13'><q id='z1L13'></q></dir></style></legend>
  • <small id='z1L13'></small><noframes id='z1L13'>

  • <tfoot id='z1L13'></tfoot>
    <i id='z1L13'><tr id='z1L13'><dt id='z1L13'><q id='z1L13'><span id='z1L13'><b id='z1L13'><form id='z1L13'><ins id='z1L13'></ins><ul id='z1L13'></ul><sub id='z1L13'></sub></form><legend id='z1L13'></legend><bdo id='z1L13'><pre id='z1L13'><center id='z1L13'></center></pre></bdo></b><th id='z1L13'></th></span></q></dt></tr></i><div id='z1L13'><tfoot id='z1L13'></tfoot><dl id='z1L13'><fieldset id='z1L13'></fieldset></dl></div>

        <bdo id='z1L13'></bdo><ul id='z1L13'></ul>

        MySQL:如何做到行级安全(如 Oracle 的 Virtual Private Database)?

        时间:2024-04-16
        <tfoot id='Cyhxm'></tfoot>

          1. <small id='Cyhxm'></small><noframes id='Cyhxm'>

              <tbody id='Cyhxm'></tbody>
            <legend id='Cyhxm'><style id='Cyhxm'><dir id='Cyhxm'><q id='Cyhxm'></q></dir></style></legend>
              • <bdo id='Cyhxm'></bdo><ul id='Cyhxm'></ul>
              • <i id='Cyhxm'><tr id='Cyhxm'><dt id='Cyhxm'><q id='Cyhxm'><span id='Cyhxm'><b id='Cyhxm'><form id='Cyhxm'><ins id='Cyhxm'></ins><ul id='Cyhxm'></ul><sub id='Cyhxm'></sub></form><legend id='Cyhxm'></legend><bdo id='Cyhxm'><pre id='Cyhxm'><center id='Cyhxm'></center></pre></bdo></b><th id='Cyhxm'></th></span></q></dt></tr></i><div id='Cyhxm'><tfoot id='Cyhxm'></tfoot><dl id='Cyhxm'><fieldset id='Cyhxm'></fieldset></dl></div>
                  本文介绍了MySQL:如何做到行级安全(如 Oracle 的 Virtual Private Database)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  假设我有销售各种产品的供应商.因此,在基本层面上,我将拥有以下表格:vendorproductvendor_product.

                  Say that I have vendors selling various products. So, at a basic level, I will have the following tables: vendor, product, vendor_product.

                  如果 vendor-1 将 Widget 1 添加到 product 表,我只希望 vendor-1 看到该信息(因为该信息由供应商拥有"-1).供应商 2 也是如此.假设 vendor-2 添加了 Widget 2,只有 vendor-2 应该看到该信息.

                  If vendor-1 adds Widget 1 to the product table, I want only vendor-1 to see that information (because that information is "owned" by vendor-1). Same goes for vendor-2. Say vendor-2 adds Widget 2, only vendor-2 should see that information.

                  如果 vendor-1 尝试添加已由 vendor-2 输入的 Widget 2,则 Widget 2 不应在 中重复输入>product 表.这意味着,不知何故,我需要知道 vendor-2 现在也拥有"Widget 2.

                  If vendor-1 tries to add Widget 2, which was already entered by vendor-2, a duplicate entry for Widget 2 should not be made in the product table. This means that, somehow, I need to know that vendor-2 now also "owns" Widget 2.

                  一条信息有多个所有者"的一个问题是如何处理所有者编辑/删除数据.也许 vendor-1 不再希望 Widget 2 对他/她可用,但这不一定适用于 vendor-2.

                  A problem with having multiple "owners" of a piece of information is how to deal owners editing/deleting the data. Perhaps vendor-1 no longer wants Widget 2 to be available to him/her, but that doesn't necessarily apply for vendor-2.

                  最后,我希望能够将某些记录标记(?)为是的,我已经审查了这些数据并且它是正确的",以便所有供应商都可以使用它.假设我将 Widget 1 标记为好数据,该产品现在应该被所有供应商看到.

                  Finally, I want the ability to flag(?) certain records as "yes, I have reviewed this data and it is correct" such that it then becomes available to all the vendors. Say I flag Widget 1 as good data, that product should now be seen by all vendors.

                  似乎解决方案是行级安全性.问题是我不太熟悉它的概念或如何在 MySQL 中实现它.任何帮助都受到高度赞赏.谢谢.

                  It seems that the solution is row level security. The problem is that I'm not too familiar with its concepts or how to implement it in MySQL. Any help is highly appreciated. Thanks.

                  注意:这里稍微讨论了这个问题:数据库设计:使用复合键作为FK,标记数据共享?.当我问这个问题时,我不确定如何很好地表达这个问题.希望这次我能更好地解释我的问题.

                  NOTE: this problem is somewhat discussed here: Database Design: use composite key as FK, flag data for sharing?. When I asked the question, I wasn't sure how to phrase the question very well. Hopefully, I explained my problem better this time.

                  推荐答案

                  Mysql 本身不支持表的行级安全性.但是,您可以使用视图来实现它.因此,只需在您的表上创建一个视图,该视图仅公开您希望给定客户端看到的行.然后,仅向该客户端提供对这些视图的访问权限,而不提供对基础表的访问权限.

                  Mysql doesn't natively support row level security on tables. However, you can sort of implement it with views. So, just create a view on your table that exposes only the rows you want a given client to see. Then, only provide that client access to those views, and not the underlying tables.

                  参见 http://www.sqlmaestro.com/resources/all/row_level_security_mysql/

                  这篇关于MySQL:如何做到行级安全(如 Oracle 的 Virtual Private Database)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:MySQL基于外键的第二个自增字段 下一篇:创建分层定义的数据集的扁平表/视图

                  相关文章

                  <small id='24mcm'></small><noframes id='24mcm'>

                  1. <tfoot id='24mcm'></tfoot>
                      <bdo id='24mcm'></bdo><ul id='24mcm'></ul>
                    <i id='24mcm'><tr id='24mcm'><dt id='24mcm'><q id='24mcm'><span id='24mcm'><b id='24mcm'><form id='24mcm'><ins id='24mcm'></ins><ul id='24mcm'></ul><sub id='24mcm'></sub></form><legend id='24mcm'></legend><bdo id='24mcm'><pre id='24mcm'><center id='24mcm'></center></pre></bdo></b><th id='24mcm'></th></span></q></dt></tr></i><div id='24mcm'><tfoot id='24mcm'></tfoot><dl id='24mcm'><fieldset id='24mcm'></fieldset></dl></div>
                    <legend id='24mcm'><style id='24mcm'><dir id='24mcm'><q id='24mcm'></q></dir></style></legend>