MySql: Restrict update permission on one column in one table(MySql:限制一张表中一列的更新权限)
问题描述
我有一个表,我们称之为学生,在一个名为注册的模式中.表学生有一个名为地址的列,我不希望某个用户更新(其他权限很好,例如选择、插入).该表和该模式中的所有其他列都应具有更新权限.
I have a table, lets call it student, in a schema called enrollment. Table student has a column called address that I don't want a certain user to update (other permissions are fine such as select, insert). All other columns in that table AND in that schema should have the update privilege.
这可行吗?
推荐答案
可以设置数据库/表/列的权限.但我真的不会尝试在那个级别使用 MySQL 的权限机制.相反,我会编写应用程序代码来决定谁可以看到/更改什么.从长远来看,这更加灵活.并且对用户来说更优雅——而不是收到关于权限的神秘 MySQL 错误消息,UI 根本不会显示不应该显示的内容.对于更新,UI 甚至不会给用户选项.
You can set privileges on database / table / column. But I really would not try to use MySQL's privilege mechanism at that level. I would instead write application code to decide who can see/change what. This is more flexible in the long run. And more graceful to the user -- instead of getting a cryptic MySQL error message about permissions, the UI would simply not show what should not be shown. For updating, the UI would not even give the user the option.
这篇关于MySql:限制一张表中一列的更新权限的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:MySql:限制一张表中一列的更新权限


- 远程 mySQL 连接抛出“无法使用旧的不安全身份验证连接到 MySQL 4.1+"来自 XAMPP 的错误 2022-01-01
- 导入具有可变标题的 Excel 文件 2021-01-01
- 更改自动增量起始编号? 2021-01-01
- SQL 临时表问题 2022-01-01
- 如何使用 pip 安装 Python MySQLdb 模块? 2021-01-01
- 以一个值为轴心,但将一行上的数据按另一行分组? 2022-01-01
- 使用 Oracle PL/SQL developer 生成测试数据 2021-01-01
- 如何将 SonarQube 6.7 从 MySQL 迁移到 postgresql 2022-01-01
- 如何将 Byte[] 插入 SQL Server VARBINARY 列 2021-01-01
- 在SQL中,如何为每个组选择前2行 2021-01-01