Make a single table in mysql read-only

前端 未结 2 1853
情歌与酒
情歌与酒 2020-12-09 10:07

How can I make a single table in mysql read only for a user while he still has write access to other tables in the same db?

Additional info

  • I have root
相关标签:
2条回答
  • 2020-12-09 10:29

    You can make a single MyISAM table read only by compressing the table. Use myisampack on the command line to pack the table.

    More info can be found in the MySQL Manual: http://dev.mysql.com/doc/refman/5.0/en/myisampack.html

    0 讨论(0)
  • 2020-12-09 10:51

    Revoke all previous privileges and then grant the specific new privileges:

    REVOKE ALL ON db.table FROM user;
    REVOKE ALL ON db.othertable FROM user;
    GRANT SELECT ON db.table TO user;
    GRANT SELECT, INSERT, UPDATE, DELETE ON db.othertable TO user;
    
    0 讨论(0)
提交回复
热议问题