Make a single table in mysql read-only

前端 未结 2 1866
情歌与酒
情歌与酒 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条回答
  •  旧时难觅i
    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;
    

提交回复
热议问题