mysql怎么给数据库里面的表最高权限

mysql怎么给数据库里面的表最高权限,第1张

语法:

1.grant 权限 on 数据库.数据表 to '用户' @ '主机名'

例:给 xiaogang 分配所有的权限

grant all on *.* to 'xiaogang'@'%'

这个时候 xiaogang 就拥有了 所有权限了

3 如何更精准的控制用户的权限呢?

1.grant 权限 on 数据库.数据表 to '用户' @ '主机名'

例:让 xiaogang 有查询 tmp 数据库 tmp1 表的权限;

grant select on temp.temp1 to 'xiaogang'@'%' //这个时候 xiaogang 就具有查询temp小的temp1的权限了。

例如:

mysql>grant select,insert,update,delete,create,drop on vtdc.employee to [email protected] identified by ‘123′

给来自10.163.225.87的用户joe分配可对数据库vtdc的employee表进行select,insert,update,delete,create,drop等 *** 作的权限,并设定口令为123。

mysql>grant all privileges on vtdc.* to [email protected] identified by ‘123′

给来自10.163.225.87的用户joe分配可对数据库vtdc所有表进行所有 *** 作的权限,并设定口令为123。

mysql>grant all privileges on *.* to [email protected] identified by ‘123′

给来自10.163.225.87的用户joe分配可对所有数据库的所有表进行所有 *** 作的权限,并设定口令为123。

mysql>grant all privileges on *.* to joe@localhost identified by ‘123′

给本机用户joe分配可对所有数据库的所有表进行所有 *** 作的权限,并设定口令为123。

grant select,update on app.user to app@‘%’ identified by '123456' --允许通过远程访问

grant select,update on app.user to app@‘localhost' identified by '123456' ---这样本地服务器授权。MySQL不像Oracle,它授权的时候要区分是通过远程访问还是本地访问的。


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/zaji/7225057.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-04-03
下一篇 2023-04-03

发表评论

登录后才能评论

评论列表(0条)

保存