1. 创建用户
CREATE USER 'user01'@'localhost' IDENTIFIED BY '123456';
2.赋予用户只读权限
GRANT SELECT, SHOW VIEW ON `database`.* TO 'user01'@'localhost' IDENTIFIED BY '123456'; FLUSH PRIVILEGES;
3.赋予用户只能查询某一张表或视图的权限
GRANT SELECT, SHOW VIEW ON database.tableName TO 'user01'@'localhost';
4.赋予用户所有权限
GRANT ALL ON *.* TO user01@'%' IDENTIFIED BY '123456'; FLUSH PRIVILEGES;
5.查询用户拥有的权限
SHOW GRANTS FOR use01@localhost