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:限制一张表中一列的更新权限
基础教程推荐
- SSMS 中的权限问题:“对象 'extended_properties'、数据库 'mssqlsystem_resource'、... 错误 229)上的 SELECT 权限被拒绝" 2022-01-01
- SQL 效率:WHERE IN 子查询 vs. JOIN 然后 GROUP 2021-01-01
- 需要 MySQL 5.1 中的抽象触发器来更新审计日志 2021-01-01
- SQL:使用来自具有相同列名的两个表中的数据... 2021-01-01
- 在 SQL 中连接多个表 2021-01-01
- 将 SQL Server DateTime 列迁移到 DateTimeOffset 2021-01-01
- 如何使用 mysql.connector 禁用查询缓存 2022-01-01
- 无法解决整理冲突 2021-01-01
- SQL Server 实例在登录协商期间返回无效或不受支持的协议版本 2021-01-01
- 是否可以执行按位分组功能? 2021-01-01
