本文主要是介绍mysql权限管理,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
用户的创建
create user "yanzhao1"@"localhost" identified by "2019210902";
create user "yanzhao2"@"localhost" identified by "2019210902";
create user "yanzhao3"@"localhost" identified by "2019210902";
create user "yanzhao4"@"localhost" identified by "2019210902";
grant select,insert,update on *.* to "yanzhao4"@"localhost";
用户授权
- 授予第一个用户为数据库级用户,对 dreamhom 拥有所有权
grant all on dreamhom.* to “yanzhao1”@”localhost”;
- 授予第二个用户为表级用户,对dreamhom中的staff 表具有select,insert,delete 权限
grant select,insert,delete on dreamhom.staff to “yanzhao2”@”localhost”;
- 授予第三个用户为列级用户,对 dreamhom 中的 staff 表的 fname列以及 lname 拥有 select 权限
grant select(fname,lname) on dreamhom.staff to “yanzhao3”@”localhost”;
权限回收
revoke select on *.* from "yanzhao4"@"localhost";
删除用户
drop user "yanzhao4"@"localhost";
这篇关于mysql权限管理的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!