91超碰碰碰碰久久久久久综合_超碰av人澡人澡人澡人澡人掠_国产黄大片在线观看画质优化_txt小说免费全本

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

MySQL之賬號管理

發布時間:2020-05-27 08:43:39 來源:網絡 閱讀:785 作者:zengwj1949 欄目:MySQL數據庫

一 賬號管理

1 創建賬號:

示例 1:

建立賬號zwj,權限為在所有數據庫上具有所有權限

mysql> grant all on *.* to 'zwj'@'192.168.154.180';

Query OK, 0 rows affected (0.01 sec)


為zwj設置密碼

mysql> grant all on *.* to 'zwj'@'192.168.154.180' identified by 'zwj';

Query OK, 0 rows affected (0.00 sec)


示例 2:

建立用戶user01,權限為test庫里所有表進行select、update、insert、delete操作,密碼為"a123"。

mysql> grant select,update,insert,delete on test.* to 'user01'@'192.168.154.%' identified by 'a123';

Query OK, 0 rows affected (0.09 sec)


2 查看權限

查看指定賬戶的權限

mysql> show grants for 'user01'@'192.168.154.%';

+-------------------------------------------------------------------------------------------------------------------+

| Grants for user01@192.168.154.%                                                                                   |

+-------------------------------------------------------------------------------------------------------------------+

| GRANT USAGE ON *.* TO 'user01'@'192.168.154.%' IDENTIFIED BY PASSWORD '*FF680E568727C9C00FABFEE03D13BA727047CC65' |

| GRANT SELECT, INSERT, UPDATE, DELETE ON `test`.* TO 'user01'@'192.168.154.%'                                      |

+-------------------------------------------------------------------------------------------------------------------+

2 rows in set (0.00 sec)


查看當前用戶權限

mysql> show grants;

+----------------------------------------------------------------------------------------------------------------------------------------+

| Grants for root@localhost                                                                                                              |

+----------------------------------------------------------------------------------------------------------------------------------------+

| GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' IDENTIFIED BY PASSWORD '*DCB7DF5FFC82C441503300FFF165257BC551A598' WITH GRANT OPTION |

| GRANT PROXY ON ''@'' TO 'root'@'localhost' WITH GRANT OPTION                                                                           |

+----------------------------------------------------------------------------------------------------------------------------------------+

2 rows in set (0.00 sec)


3 更改權限

新建用戶

mysql> grant select on test.* to 'bbs'@'192.168.154.%' identified by 'bbs';

Query OK, 0 rows affected (0.00 sec)

mysql> show grants for 'bbs'@'192.168.154.%';

+----------------------------------------------------------------------------------------------------------------+

| Grants for bbs@192.168.154.%                                                                                   |

+----------------------------------------------------------------------------------------------------------------+

| GRANT USAGE ON *.* TO 'bbs'@'192.168.154.%' IDENTIFIED BY PASSWORD '*74BAEAC2CAFC5C7162EF373C5C85EFBC7FC8B803' |

| GRANT SELECT ON `test`.* TO 'bbs'@'192.168.154.%'                                                              |

+----------------------------------------------------------------------------------------------------------------+

2 rows in set (0.00 sec)


增加權限

mysql> grant select,insert,delete on test.* to 'bbs'@'192.168.154.%';

Query OK, 0 rows affected (0.00 sec)


mysql> show grants for 'bbs'@'192.168.154.%';

+----------------------------------------------------------------------------------------------------------------+

| Grants for bbs@192.168.154.%                                                                                   |

+----------------------------------------------------------------------------------------------------------------+

| GRANT USAGE ON *.* TO 'bbs'@'192.168.154.%' IDENTIFIED BY PASSWORD '*74BAEAC2CAFC5C7162EF373C5C85EFBC7FC8B803' |

| GRANT SELECT, INSERT, DELETE ON `test`.* TO 'bbs'@'192.168.154.%'                                              |

+----------------------------------------------------------------------------------------------------------------+

2 rows in set (0.00 sec)


撤銷權限

mysql> revoke delete,insert on test.* from 'bbs'@'192.168.154.%';

Query OK, 0 rows affected (0.01 sec)


mysql> show grants for 'bbs'@'192.168.154.%';

+----------------------------------------------------------------------------------------------------------------+

| Grants for bbs@192.168.154.%                                                                                   |

+----------------------------------------------------------------------------------------------------------------+

| GRANT USAGE ON *.* TO 'bbs'@'192.168.154.%' IDENTIFIED BY PASSWORD '*74BAEAC2CAFC5C7162EF373C5C85EFBC7FC8B803' |

| GRANT SELECT ON `test`.* TO 'bbs'@'192.168.154.%'                                                              |

+----------------------------------------------------------------------------------------------------------------+

2 rows in set (0.00 sec)


4 修改賬號密碼

方式 1:

mysql> set password for 'bbs'@'192.168.154.%' = password('abc-123');

Query OK, 0 rows affected (0.01 sec)

mysql> flush privileges;

Query OK, 0 rows affected (0.00 sec)


方式 2:

mysql> update mysql.user set password=password('aaa') where user='bbs' and host='192.168.154.%';

Query OK, 1 row affected (0.00 sec)

Rows matched: 1  Changed: 1  Warnings: 0

mysql> flush privileges;

Query OK, 0 rows affected (0.00 sec)


方式 3:

[root@localhost tmp]# mysqladmin -u bbs -h 192.168.154.180 password "ccc" -p

Enter password: 

Warning: Using a password on the command line interface can be insecure.

為root初次設置密碼:

[root@www ~]# mysqladmin -uroot password "abc-123"

為root修改密碼:

[root@localhost tmp]# mysqladmin -uroot password 'root' -p

Enter password: 

Warning: Using a password on the command line interface can be insecure.


5 刪除賬戶

mysql> drop user 'bbs'@'192.168.154.%';

Query OK, 0 rows affected (0.00 sec)


mysql> show grants for 'bbs'@'192.168.154.%';

ERROR 1141 (42000): There is no such grant defined for user 'bbs' on host '192.168.154.%'


向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

铜陵市| 习水县| 南陵县| 云南省| 宜昌市| 长沙市| 太仆寺旗| 泉州市| 绍兴市| 肥西县| 定兴县| 曲水县| 凤台县| 会泽县| 建瓯市| 吴旗县| 连城县| 巫山县| 乡宁县| 延津县| 双柏县| 河北区| 桦甸市| 西林县| 台江县| 若尔盖县| 通州区| 乐清市| 岳阳县| 遵义市| 宾川县| 名山县| 新丰县| 饶平县| 兴化市| 临湘市| 德清县| 延川县| 新郑市| 深泽县| 西畴县|