Grant a user permission to only view a MySQL view and nothing else Grant a user permission to only view a MySQL view and nothing else mysql mysql

Grant a user permission to only view a MySQL view and nothing else


GRANT SELECT ON database1.view1 TO 'someuser'@'somehost';


Besides

GRANT SELECT ON <database_name>.<view_name>TO <user>@<host>

it's better to also do

GRANT SHOW VIEWON <database_name>.<view_name> TO <user>@<host>

so that a lot of SQL UI tool can get the view definition and work appropriately for the view.


GRANT SELECT ON <database name>.<view name>TO <user>@<host> IDENTIFIED BY '<password>'

Source: MySQL Documentation