大美女一区二区三区_国产日韩一区_日韩经典一区二区_欧美黄色成人网

  • IDC銷售:020-66849165/66849090/66849088
  • 云服務(wù)銷售:020-66849108/9091 | 客服(備案,域名,虛機(jī),郵箱):020-66849000-2

登錄 | 會員注冊 | 控制面板 | 幫助中心 | 購物車 | 舉報中心

? ? 域名活動
幫助中心FAQ

 

# 1. 創(chuàng)建用戶

 

命令:

create user 'username'@'host' identified by 'password';

 

說明:

username:你將創(chuàng)建的用戶名

host:指定該用戶在哪個主機(jī)上可以登陸,如果是本地用戶可用localhost,如果想讓該用戶可以從任意遠(yuǎn)程主機(jī)登陸,可以使用通配符%,但不包括localhost

password:該用戶的登陸密碼,密碼可以為空,如果為空則該用戶可以不需要密碼登陸服務(wù)器

 

```

# 例如:

create user 'user1'@'localhost' identified by 'user1';

```

 

# 2. 用戶授權(quán)或更新權(quán)限

 

命令:

grant privileges on databasename.tablename to 'username'@'host';

flush privileges;

 

說明:

privileges:用戶的操作權(quán)限,如select,INSERT,UPDATE等,如果要授予所的權(quán)限則使用ALL

databasename:數(shù)據(jù)庫名

tablename:表名,如果要授予該用戶對所有數(shù)據(jù)庫和表的相應(yīng)操作權(quán)限則可用*表示,如*.*

 

```

# 例如:

grant all on *.*  to 'user1'@'localhost';

flush privileges;

```

 

注意:

用以上命令授權(quán)的用戶不能給其它用戶授權(quán),如果想讓該用戶可以授權(quán),用以下命令:

grant privileges on databasename.tablename to 'username'@'host' with grant option;

 

# 3. 設(shè)置或更改用戶密碼

 

命令:

set password for 'username'@'host' = password('newpassword');

 

```

# 例如:

set password for 'user1'@'localhost' =password('123');

```

 

# 4. 撤銷用戶權(quán)限

 

命令:

revoke privilege on databasename.tablename from 'username'@'host';

flush privileges;

 

說明:

privilege, databasename, tablename:同授權(quán)部分

 

```

# 例如:

revoke privilege on *.* from 'user1'@'localhost';

```

 

注意:

假如在給用戶'user1'@'localhost'授權(quán)的時候是這樣的(或類似的):grant select on test.user to 'user1'@'localhost',

則在使用revoke select on *.* from 'user1'@'localhost';命令并不能撤銷該用戶對test數(shù)據(jù)庫中user表的select 操作。

相反,如果授權(quán)使用的是:grant select on *.* to 'user1'@'localhost';

revoke select on test.user from 'user1'@'localhost';命令也不能撤銷該用戶對test數(shù)據(jù)庫中user表的select權(quán)限。

具體信息可以用命令show grants for 'user1'@'localhost'; 查看。

 

# 5. 查看用戶權(quán)限

 

命令:

show grants 'username'@'host';

select * from mysql.user where User='username'G

 

```

# 例如:

select * from mysql.user where User='user1'G

show grants 'user1'@'localhost';

```

 

# 6. 刪除用戶

 

命令:

drop user 'username'@'host';

 

```

# 例如:

drop user 'user1'@'localhost';

```

主站蜘蛛池模板: 大埔县| 教育| 红原县| 政和县| 常山县| 石楼县| 美姑县| 永年县| 阳西县| 泾川县| 湘潭市| 施甸县| 西贡区| 建宁县| 垦利县| 三门峡市| 曲阳县| 河北省| 喀喇沁旗| 宿州市| 文安县| 溧水县| 晋州市| 安新县| 册亨县| 平利县| 沅陵县| 常州市| 禄丰县| 福建省| 山西省| 高台县| 泸定县| 正镶白旗| 顺平县| 新建县| 延川县| 青浦区| 海南省| 苏尼特左旗| 元氏县|