中文字幕av专区_日韩电影在线播放_精品国产精品久久一区免费式_av在线免费观看网站

溫馨提示×

溫馨提示×

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

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

MySQL8.0.16賬戶雙密碼實驗一例

發布時間:2020-08-10 18:26:05 來源:ITPUB博客 閱讀:211 作者:chenfeng 欄目:MySQL數據庫

MySQL 8.0.14開始,允許用戶帳戶擁有雙密碼,指定為主密碼和輔助密碼。

雙密碼功能可以在以下場景中無縫地執行憑證更改:

系統有大量MySQL服務器,可能涉及主從復制

多個應用程序連接到不同的MySQL服務器

必須對應用程序用于連接服務器的帳戶進行定期密碼更改


實驗如下:


mysql版本:


mysql>select version();


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


| version() |


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


| 8.0.16    |


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


1 row in set (0.00 sec)




mysql>create user root@'%' identified by '123456';


Query OK, 0 rows affected (0.25 sec)




mysql>grant all privileges on *.* to root@'%';


Query OK, 0 rows affected (0.10 sec)




mysql>alter user root@'%' identified by 'root' RETAIN CURRENT PASSWORD;


Query OK, 0 rows affected (0.28 sec)






開另外一個session:


兩個密碼都可以登錄:


# mysql -uroot -p123456 -h 192.168.140.52


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


Welcome to the MySQL monitor.  Commands end with ; or \g.


Your MySQL connection id is 21


Server version: 8.0.16 MySQL Community Server - GPL




Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.




Oracle is a registered trademark of Oracle Corporation and/or its


affiliates. Other names may be trademarks of their respective


owners.




Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.




mysql>\q


Bye




[root@test2 ~]# mysql -uroot -proot -h 192.168.140.52


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


Welcome to the MySQL monitor.  Commands end with ; or \g.


Your MySQL connection id is 22


Server version: 8.0.16 MySQL Community Server - GPL




Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.




Oracle is a registered trademark of Oracle Corporation and/or its


affiliates. Other names may be trademarks of their respective


owners.




Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.




mysql>\q


Bye




丟棄舊密碼:


mysql>alter user root@'%' DISCARD OLD PASSWORD;


Query OK, 0 rows affected (0.12 sec)




開另外一個會話,用舊密碼登錄報錯:


# mysql -uroot -p123456 -h 192.168.140.52


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


ERROR 1045 (28000): Access denied for user 'root'@'192.168.140.52' (using password: YES)




新密碼可以登錄:


# mysql -uroot -p123456 -h 192.168.140.52


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


ERROR 1045 (28000): Access denied for user 'root'@'192.168.140.52' (using password: YES)


[root@test2 ~]# 


[root@test2 ~]# 


[root@test2 ~]# mysql -uroot -proot -h 192.168.140.52


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


Welcome to the MySQL monitor.  Commands end with ; or \g.


Your MySQL connection id is 27


Server version: 8.0.16 MySQL Community Server - GPL




Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.




Oracle is a registered trademark of Oracle Corporation and/or its


affiliates. Other names may be trademarks of their respective


owners.




Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.




mysql>\q


Bye

備注:

RETAIN CURRENT PASSWORD保留帳戶當前密碼作為其輔助密碼,替換任何現有的二級密碼。新密碼將成為主密碼,

但客戶端可以使用該帳戶使用主密碼或輔助密碼連接到服務器。

對于ALTER USER, DISCARD OLD PASSWORD丟棄二級密碼(如果存在)。該帳戶僅保留其主密碼,客戶端可以使用

該帳戶僅使用主密碼連接到服務器。



向AI問一下細節

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

AI

岳池县| 长春市| 保定市| 浦北县| 象山县| 乌苏市| 彰化市| 云浮市| 嘉鱼县| 武城县| 金山区| 长兴县| 黄平县| 通辽市| 秦安县| 海口市| 山东| 阆中市| 九江市| 邢台县| 江口县| 上高县| 惠水县| 霍林郭勒市| 志丹县| 英吉沙县| 贵溪市| 栾川县| 桂阳县| 镇坪县| 崇信县| 阿图什市| 霍城县| 水富县| 丰都县| 钟祥市| 天等县| 五华县| 远安县| 新巴尔虎右旗| 铁岭市|