授權 新增操作員並設定其授予許可權和撤銷許可權。

2022-05-20 16:24:27 字數 1119 閱讀 7074

基於社群版 mysql5.7

grant [ 許可權列表 / all ] on dbname.tablename to username@"hostname"

identified by "password"

**[ with grant option ]; **

許可權列表:all (所有許可權) , usage(無許可權) 。

select ,update ,insert ...(個別許可權)

select user();//顯示當前使用登陸使用者名稱及客戶端

show grants [ for "username"@"hostname"];//顯示使用者的許可權

drop user "username"@"hostname";//刪除授權使用者

在mysql庫中記錄了使用者的授權資訊:

記錄資訊

user

記錄已有的授權使用者及對該錶的許可權

db

記錄已有授權使用者對資料庫的許可權

tables_priv

記錄已有授權使用者對錶的訪問許可權

columns_priv

記錄已有授權使用者對字段的訪問許可權

可以撤銷已有使用者的許可權,全部撤銷後可以登入賬號但對所有庫無許可權

禁止使用者登入最佳方案:修改mysql.user 下host改成不匹配即可

revoke [許可權列表/all] 

on dbname,tablename

from "username"@"hostname";

mysql新增使用者並授權

新增使用者並授權 1 新增任何機器都能登入的使用者 grant all privileges on dbname.to test identified by 1111 2 新增172.16.184.233機器登入的使用者 grant all on dbname.to test 172.16.184....

mysql新增使用者並授權

新增使用者並授權 1 新增任何機器都能登入的使用者 grant all privileges on dbname.to test identified by 1111 2 新增172.16.184.233機器登入的使用者 grant all on dbname.to test 172.16.184....

新增MySql使用者並授權

新增mysql使用者並授權 如何解決客戶端與伺服器端的連線 mysql is not allowed to connect to this mysql server mysql connect error is not allowed to connect to this mysql server ...