mysql5.7安全性小记

数据库名称:mysql5.7
执行用户:root

创建一个新用户zs
create user ‘zs’@‘localhost’ identified by ‘qqq’ ;

//查看数据库中当前所有用户:
select DISTINCT CONCAT(“User:”,user, “@”,“host”,";") as query from mysql.user ;

//给zs用户赋予增查询删除操作权限:
grant insert, select, delete on table testTable to ‘zs’@‘localhost’ ;

//给用户赋予表的所有操作权限:
grant all privileges on table testTable to ‘zs’@‘localhost’ ;

//收回用户权限:
revoke all privileges on testTable from ‘zs’@‘localhost’ ;

//收回指定的权限
revoke delete on testTable from ‘zs’@‘localhost’ ;

//立即启用所有修改
flush privileges ;

//删除指定用户
delete from mysql.user where use=‘zs’ ;

猜你喜欢

转载自blog.csdn.net/qq_41681241/article/details/93909645
今日推荐