MySql : Grant read only options?

后端 未结 7 549
南笙
南笙 2020-12-12 12:36

I have a user, whom I want to grant all the READ permission on a db schema.

One way is this :

GRANT SELECT, SHOW_VIEW  ON test.* TO \'readuser\'@\'%         


        
7条回答
  •  春和景丽
    2020-12-12 13:08

    Even user has got answer and @Michael - sqlbot has covered mostly points very well in his post but one point is missing, so just trying to cover it.

    If you want to provide read permission to a simple user (Not admin kind of)-

    GRANT SELECT, EXECUTE ON DB_NAME.* TO 'user'@'localhost' IDENTIFIED BY 'PASSWORD';
    

    Note: EXECUTE is required here, so that user can read data if there is a stored procedure which produce a report (have few select statements).

    Replace localhost with specific IP from which user will connect to DB.

    Additional Read Permissions are-

    • SHOW VIEW : If you want to show view schema.
    • REPLICATION CLIENT : If user need to check replication/slave status. But need to give permission on all DB.
    • PROCESS : If user need to check running process. Will work with all DB only.

提交回复
热议问题