1.创建用户
create user guest_test@localhost identified by "root";-- 创建名为guest_test的用户
2.赋予权限
-- 给guest_test用户赋予guest_test增删改的权限。第一个guest_test指数据库,第二个指用户名,hostname指指定ip
grant create,alter,drop on guest_test.* to [email protected]
-- 给guest_test用户赋予guest_test库中所有表的全部权限grant all privileges on *.* to [email protected] -- 给guest_test用户赋予guest_test库中所有表的查询权限grant select on database.* to [email protected] -- 给guest_test用户赋予guest_test某个表的用户权限grant select on guest_test.t1table to [email protected]
3.撤销权限
撤销guest_test用户guest_test库所有表的增删改查的权限
revoke select,update,delete,insert on guest_test.* from guest_test[email protected];flush privileges;
4.删除用户
drop user [email protected]
原文地址:https://www.cnblogs.com/hhdw/p/10134136.html
时间: 2024-10-31 10:01:19