水蜜桃2美国伦理|美国伦理巜交换做爰|美国伦理〈欲女春潮〉|宝贝腿开大点我添添你下边美国|美国色情巜春药2|美国少妇2做爰

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

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

? ? 域名活動
幫助中心FAQ

 

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

 

命令:

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

 

說明:

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

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

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

 

```

# 例如:

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

```

 

# 2. 用戶授權或更新權限

 

命令:

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

flush privileges;

 

說明:

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

databasename:數據庫名

tablename:表名,如果要授予該用戶對所有數據庫和表的相應操作權限則可用*表示,如*.*

 

```

# 例如:

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

flush privileges;

```

 

注意:

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

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

 

# 3. 設置或更改用戶密碼

 

命令:

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

 

```

# 例如:

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

```

 

# 4. 撤銷用戶權限

 

命令:

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

flush privileges;

 

說明:

privilege, databasename, tablename:同授權部分

 

```

# 例如:

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

```

 

注意:

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

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

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

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

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

 

# 5. 查看用戶權限

 

命令:

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';

```

龙门县| 霞浦县| 韶山市| 临潭县| 海伦市| 瑞安市| 湟源县| 厦门市| 大新县| 资溪县| 陵川县| 沛县| 来凤县| 望城县| 金寨县| 天津市| 曲阳县| 黔西| 万山特区| 原平市| 宝鸡市| 宜宾市| 星座| 华亭县| 永福县| 墨江| 淮南市| 柏乡县| 阿拉尔市| 集贤县| 临西县| 松阳县| 呈贡县| 乌拉特中旗| 平遥县| 宜章县| 江永县| 佛冈县| 思茅市| 红河县| 张家口市|