数据库
首页 > 数据库> > Mysql权限设置

Mysql权限设置

作者:互联网

#添加用户
create user 'xiaojie'@'%'identified by 'root';

#删除用户
drop user xiaojie;

#为用户授权所有数据库的增删改查操作
grant select,insert,update,delete on *.* to xiaojie@'%';

#刷新权限
FLUSH PRIVILEGES;

#给用户新增某个表的增删改查权限
grant select, insert, update, delete,create on my_test.tb_user to xiaojie@'%';
FLUSH PRIVILEGES;

#给用户设定某个数据库中的所有表的权限
grant select, insert, update, delete,create on my_test.* to xiaojie@'%';
FLUSH PRIVILEGES;

#create权限
grant create on *.* to xiaojie@'%' ; 
FLUSH PRIVILEGES;

#修改表权限
grant alter on *.* to xiaojie@'%' ; 
FLUSH PRIVILEGES;

#删除表权限
grant drop on *.* to xiaojie@'%' ;
FLUSH PRIVILEGES; 

#对用户赋予所有数据库的所有权限
grant all  on *.*  to xiaojie;
FLUSH PRIVILEGES; 

#刷新数据库
grant reload  on *.*  to xiaojie;
FLUSH PRIVILEGES; 

#给用户设定mysql数据库下所有表的所有权限
grant all  on mysql.*  to xiaojie;
FLUSH PRIVILEGES; 

#给用户撤销mysql数据库下所有表的所有权限
revoke  all on mysql.*  from  xiaojie;
FLUSH PRIVILEGES; 

#撤销create权限
revoke  create on *.* from xiaojie@'%'; 
FLUSH PRIVILEGES;

查看权限
show grants for xiaojie;

标签:grant,PRIVILEGES,Mysql,xiaojie,设置,FLUSH,权限,create
来源: https://blog.csdn.net/weixin_39555954/article/details/121338317