mysql 授權 mysql 使用者授權

2021-10-25 14:01:43 字數 1429 閱讀 5546

mysql> grant 許可權1,許可權2,…許可權n on 資料庫名稱.表名稱 to 使用者名稱@使用者位址 identified by 『連線口令』;

許可權1,許可權2,…許可權n代表select,insert,update,delete,create,drop,index,alter,grant,references,reload,shutdown,process,file等14個許可權。

當許可權1,許可權2,…許可權n被all privileges或者all代替,表示賦予使用者全部許可權。

當資料庫名稱.表名稱被.代替,表示賦予使用者操作伺服器上所有資料庫所有表的許可權。

使用者位址可以是localhost,也可以是ip位址、機器名字、網域名稱。也可以用』%'表示從任何位址連線。

『連線口令』不能為空,否則建立失敗。

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 all privileges on . to root@'192.168.0.%' identified by '123456'

grant all privileges on . to root@'211.149.231.21' identified by 'uk8f$4_^6';

flush privileges;

grant all privileges on . to root@'106.75.28.32' identified by 'yj123456';

flush privileges;

grant all privileges on . to root@'%' identified by 'dev_pwd';

flush privileges;

mysql 網路授權工具 mysql給主機授權

grant語句雖然能夠為使用者分配許可權,使用比較方便,但是從安全角度,從增加對系統了解角度,你應該盡量使用直接修改授權表的方法。這樣可以更精確的控制授權,能夠對授權表完全了解,避免因為 grant語句的錯誤,是mysql伺服器的安全性降低。首先進入mysql的命令列 允許位址192.168.0.5...

mysql授權使用者許可權 mysql授權使用者許可權

grant 普通資料使用者,查詢 插入 更新 刪除 資料庫中所有表資料的權利。grant select on testdb.to common user grant insert on testdb.to common user grant update on testdb.to common us...

mysql 新增使用者 mysql建立使用者與授權

一 建立使用者 create user username host identified by password 說明username 你將建立的使用者名稱 host 指定該使用者在哪個主機上可以登陸,如果是本地使用者可用localhost,如果想讓該使用者可以從任意遠端主機登陸,可以使用萬用字元 ...