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根据从其他列分组的值,对两列之间的值进行求和 2022-01-01
- 带更新的 sqlite CTE 2022-01-01
- while 在触发器内循环以遍历 sql 中表的所有列 2022-01-01
- MySQL 5.7参照时间戳生成日期列 2022-01-01
- 从字符串 TSQL 中获取数字 2021-01-01
- CHECKSUM 和 CHECKSUM_AGG:算法是什么? 2021-01-01
- 使用 VBS 和注册表来确定安装了哪个版本和 32 位 2021-01-01
- 带有WHERE子句的LAG()函数 2022-01-01
- 如何在 CakePHP 3 中实现 INSERT ON DUPLICATE KEY UPDATE aka upsert? 2021-01-01
- ORA-01830:日期格式图片在转换整个输入字符串之前结束/选择日期查询的总和 2021-01-01
