MySql:限制一张表中一列的更新权限

MySql: Restrict update permission on one column in one table(MySql:限制一张表中一列的更新权限)
本文介绍了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:限制一张表中一列的更新权限的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

Hibernate reactive No Vert.x context active in aws rds(AWS RDS中的休眠反应性非Vert.x上下文处于活动状态)
Bulk insert with mysql2 and NodeJs throws 500(使用mysql2和NodeJS的大容量插入抛出500)
Flask + PyMySQL giving error no attribute #39;settimeout#39;(FlASK+PyMySQL给出错误,没有属性#39;setTimeout#39;)
auto_increment column for a group of rows?(一组行的AUTO_INCREMENT列?)
Sort by ID DESC(按ID代码排序)
SQL/MySQL: split a quantity value into multiple rows by date(SQL/MySQL:按日期将数量值拆分为多行)