数据库名称: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’ ;