Ubuntu中給mysql使用者分配許可權

2021-08-16 03:28:45 字數 1048 閱讀 1578

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。 

Ubuntu中給mysql新增新使用者並分配許可權

etc init.d sudo mysqld 二.使用者新增 bin mysql u root mysql grant 許可權1,許可權2,許可權n on 資料庫名稱.表名稱 to 使用者名稱 使用者位址 identified by 連線口令 許可權1,許可權2,許可權n代表select,inser...

Ubuntu中給mysql新增新使用者並分配許可權

一.ubuntu下啟動mysql方法 etc init.d sudo mysqld 二.使用者新增 bin mysql u root mysql grant 許可權1,許可權2,許可權n on 資料庫名稱.表名稱 to 使用者名稱 使用者位址 identified by 連線口令 許可權1,許可權2...

ubuntu給使用者sudo許可權

翻譯自 加入使用者 sudo adduser 檢視使用者組 groups 加入sudo組 sudo usermod ag sudo 刪除使用者 sudo deluser,sudo deluser remove home 1.使用如下命令可以新增到使用者組 也可是超級使用者組 命令如下 sudo us...