grant命令的基本格式
1 grant 權(quán)限 on 數(shù)據(jù)庫對象 to 用戶
實(shí)例一:在任意ip地址登陸的common_user用戶可以對testdb數(shù)據(jù)庫里的數(shù)據(jù)進(jìn)行查詢操作、插入操作、更新操作、刪除操作
1 grant select on testdb. * to common_user@ ' % ' // 有查詢數(shù)據(jù)的權(quán)限 2 grant insert on testdb. * to common_user@ ' % ' // 有出入數(shù)據(jù)的權(quán)限 3 grant update on testdb. * to common_user@ ' % ' // 有更新數(shù)據(jù)的權(quán)限 4 grant delete on testdb. * to common_user@ ' % ' // 有刪除數(shù)據(jù)的權(quán)限
以上命令等價以下命令。
grant select , insert , update , delete on testdb. * to common_user@ ' % '
實(shí)例二:在ip為192.168.0.1到192.168.0.255之間登陸的developer用戶可以對testdb數(shù)據(jù)庫里的表進(jìn)行創(chuàng)建、修改、刪除操作
1 grant create on testdb. * to developer@ ' 192.168.0.% ' ; // 有創(chuàng)建表的權(quán)限 2 grant alter on testdb. * to developer@ ' 192.168.0.% ' ; // 有修改表的權(quán)限 3 grant drop on testdb. * to developer@ ' 192.168.0.% ' ; // 有刪除表的權(quán)限
?
參考網(wǎng)址:http://www.cnblogs.com/hcbin/archive/2010/04/23/1718379.html
?
更多文章、技術(shù)交流、商務(wù)合作、聯(lián)系博主
微信掃碼或搜索:z360901061

微信掃一掃加我為好友
QQ號聯(lián)系: 360901061
您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描下面二維碼支持博主2元、5元、10元、20元等您想捐的金額吧,狠狠點(diǎn)擊下面給點(diǎn)支持吧,站長非常感激您!手機(jī)微信長按不能支付解決辦法:請將微信支付二維碼保存到相冊,切換到微信,然后點(diǎn)擊微信右上角掃一掃功能,選擇支付二維碼完成支付。
【本文對您有幫助就好】元
