Mysql如何新建一个用户并赋予视图权限
Mysql如何新建一个用户并赋予视图权限
-- 新建用户
CREATE USER 'viewUser'@'%' IDENTIFIED BY 'password';
-- 赋予视图权限
GRANT SELECT, SHOW VIEW ON `views` TO 'viewUser'@'%'
-- 并把视图内容关系到的表权限赋予新用户
GRANT SELECT ON `tableName` TO 'viewUser'@'%';
-- 新建用户
CREATE USER 'viewUser'@'%' IDENTIFIED BY 'password';
-- 赋予视图权限
GRANT SELECT, SHOW VIEW ON `views` TO 'viewUser'@'%'
-- 并把视图内容关系到的表权限赋予新用户
GRANT SELECT ON `tableName` TO 'viewUser'@'%';