mysql创建新用户并授权限

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

 

上一篇:docker mysql 安装


下一篇:JavaFX TitledPane更改的标题背景在输入鼠标时重置