开发者

Write once, read many mysql field

C开发者_开发知识库an you restrict a field from being updated without granting any additional user privileges ?

Basically a value in a row can only be set during an insert statement.


Yes. If you grant only insert and select privileges. Like:

grant select, insert, update(message, time) on hibtest.message to 'worm'@'localhost' identified by 'worm'

... this way the user can only update message and time columns.


You can use an update trigger to prevent the value from being updated.


Mysql differentiate between insert privileges and update privileges, which would give a user the option to insert, but not update later on.

see this link: http://dev.mysql.com/doc/refman/5.5/en/privileges-provided.html


Not an exact fit for your question: If you run mysqlisampack on the table, the table will become read-only.

This is good if you have a datawharehouse that is reference only, but not good if you just want to make a "live" column read-only.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜