1.在root用戶(hù)操作下,對(duì)user1用戶(hù)賦予查詢(xún)shop數(shù)據(jù)庫(kù)的權(quán)限
<pre>
grant select on shop .* to 'user1'@'localhost';
</pre>
作用:user1用戶(hù)便可以查詢(xún)shop數(shù)據(jù)庫(kù)
2.在root用戶(hù)操作下,對(duì)user1用戶(hù)賦予插入shop數(shù)據(jù)庫(kù)的權(quán)限
<pre>
grant insert on shop .* to 'user1'@'localhost';
</pre>
作用:user1用戶(hù)便可以插入shop數(shù)據(jù)
3.【identified by ‘密碼’】是可省略部分,如果不省略,就表示賦權(quán)的同時(shí),也去修改它的密碼
但:如果該用戶(hù)不存儲(chǔ),此時(shí)其實(shí)就是創(chuàng)建一個(gè)新用戶(hù);并此時(shí)就必須設(shè)置其密碼了
![3DLXND{[KZV]_7ML@ZOY]M9.png](http://upload-images.jianshu.io/upload_images/5357116-b0a9f68acc51e7d7.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)