Mysql权限设置

2021/11/16 2:10:22

本文主要是介绍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;



这篇关于Mysql权限设置的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!


扫一扫关注最新编程教程