MySQL5.6配置安全的加密密碼-創(chuàng)新互聯(lián)

在s

創(chuàng)新互聯(lián)公司堅持“要么做到,要么別承諾”的工作理念,服務(wù)領(lǐng)域包括:網(wǎng)站設(shè)計制作、網(wǎng)站制作、企業(yè)官網(wǎng)、英文網(wǎng)站、手機端網(wǎng)站、網(wǎng)站推廣等服務(wù),滿足客戶于互聯(lián)網(wǎng)時代的陵水黎族網(wǎng)站設(shè)計、移動媒體設(shè)計的需求,幫助企業(yè)找到有效的互聯(lián)網(wǎng)解決方案。努力成為您成熟可靠的網(wǎng)絡(luò)建設(shè)合作伙伴!hell腳本中,通常要配置數(shù)據(jù)庫的明文密碼,這是不安全的。在MySQL 5.6版本以后,可以配置安全的加密密碼文件,之后可以使用加密后的密碼文件連接數(shù)據(jù)庫,而不需要輸入明文密碼。
為本地root用戶配置安全加密密碼
[root@localhost ~]# mysql_config_editor set --user=root --password
Enter password:
嘗試連接數(shù)據(jù)庫
[root@localhost ~]# mysql
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 179
Server version: 5.6.31-77.0-log Percona Server (GPL), Release 77.0, Revision 5c1061c
Copyright (c) 2009-2016 Percona LLC and/or its affiliates
Copyright (c) 2000, 2016, 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> select user();
+----------------+
| user()         |
+----------------+
| root@localhost |
+----------------+
1 row in set (0.00 sec)
mysql> exit
Bye
到家目錄,查看加密密碼文件,可以看到里面的亂碼
[root@localhost ~]# cd
[root@localhost ~]# cat .mylogin.cnf
?
?#[root@localhost ~]# p_?EQ!?a\S??T SB??hH?XJ?-&?P?-/?|m5?
配置指定的遠程數(shù)據(jù)庫連接用戶
[root@localhost ~]# mysql_config_editor set --login-path=remote --host=192.168.56.101 --user=ss7 --password
Enter password:
查看配置過的加密密碼清單
[root@localhost ~]# mysql_config_editor print --all
[client]
user = root
password = *****
[remote]
user = ss7
password = *****
host = 192.168.56.101
嘗試連接數(shù)據(jù)庫
[root@localhost ~]# mysql --login-path=remote
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 181
Server version: 5.6.31-77.0-log Percona Server (GPL), Release 77.0, Revision 5c1061c
Copyright (c) 2009-2016 Percona LLC and/or its affiliates
Copyright (c) 2000, 2016, 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> select user();
+--------------------+
| user()             |
+--------------------+
| ss7@192.168.56.101 |
+--------------------+
1 row in set (0.00 sec)
mysql> exit
Bye
通過--login-path選項連接root本地用戶
[root@localhost ~]# mysql --login-path=client
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 182
Server version: 5.6.31-77.0-log Percona Server (GPL), Release 77.0, Revision 5c1061c
Copyright (c) 2009-2016 Percona LLC and/or its affiliates
Copyright (c) 2000, 2016, 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> select user();
+----------------+
| user()         |
+----------------+
| root@localhost |
+----------------+
1 row in set (0.00 sec)

網(wǎng)站欄目:MySQL5.6配置安全的加密密碼-創(chuàng)新互聯(lián)
轉(zhuǎn)載來于:http://muchs.cn/article46/ddhihg.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供ChatGPT、定制開發(fā)網(wǎng)站設(shè)計公司、網(wǎng)站排名網(wǎng)站營銷、手機網(wǎng)站建設(shè)

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)

搜索引擎優(yōu)化