溫馨提示×

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

密碼登錄×
登錄注冊(cè)×
其他方式登錄
點(diǎn)擊 登錄注冊(cè) 即表示同意《億速云用戶服務(wù)條款》

如何進(jìn)行 mysql_config_editor/login-path 登錄密碼保護(hù)

發(fā)布時(shí)間:2021-11-08 10:56:45 來源:億速云 閱讀:190 作者:柒染 欄目:建站服務(wù)器

如何進(jìn)行 mysql_config_editor/login-path 登錄密碼保護(hù),相信很多沒有經(jīng)驗(yàn)的人對(duì)此束手無策,為此本文總結(jié)了問題出現(xiàn)的原因和解決方法,通過這篇文章希望你能解決這個(gè)問題。

login-path是MySQL5.6開始支持的新特性。通過借助mysql_config_editor工具將登陸MySQL服務(wù)的認(rèn)證信息加密保存在.mylogin.cnf文件(默認(rèn)位于用戶主目錄) 。之后,MySQL客戶端工具可通過讀取該加密文件連接MySQL,避免重復(fù)輸入登錄信息,避免敏感信息暴露。
mysql_config_editor使用幫助:
配置:
mysql_config_editor set --host=127.0.0.1 --login-path=local3306 --port=3306 --user=root -p

其中可配置項(xiàng)
-h,–host=name 添加host到登陸文件中
-G,–login-path=name 在登錄文件中為login path添加名字(默認(rèn)為client)
-p,–password 在登陸文件中添加密碼(該密碼會(huì)被mysql_config_editor自動(dòng)加密)
-u,–user 添加用戶名到登陸文件中
-S,–socket=name 添加sock文件路徑到登陸文件中
-P,–port=name 添加登陸端口到登陸文件中
顯示配置:
mysql_config_editor print --login-path=local3306 #顯示執(zhí)行的login-path配置
mysql_config_editor print --all #顯示所有的login-path信息
刪除配置:
mysql_config_editor remove --login-path=local3306
其中可刪除項(xiàng)
-h,–host=name 添加host到登陸文件中
-G,–login-path=name 在登錄文件中為login path添加名字(默認(rèn)為client)
-p,–password 在登陸文件中添加密碼(該密碼會(huì)被mysql_config_editor自動(dòng)加密)
-u,–user 添加用戶名到登陸文件中
-S,–socket=name 添加sock文件路徑到登陸文件中
-P,–port=name 添加登陸端口到登陸文件中
重置配置:
mysql_config_editor reset --login-path=local3306
使用login-path登錄:
shell>mysql --login-path=local3306

若要登錄其他主機(jī)、其他端口,或者添加其他額外參數(shù),直接在上述命令后添加即可
shell>mysql --login-path=local3306 -h host1 -P port1 #登錄host1:poet1上的MySQL

shell>mysql --login-path=local3306 -h host1 -P port1 local3306_db #登錄 host1:poet1 上的MySQL中的local3306_db庫

[root@12c01 ~]# mysql --login-path=local3306 test ## 直接進(jìn)入配置環(huán)境 test 庫
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

01:52 test>

看完上述內(nèi)容,你們掌握如何進(jìn)行 mysql_config_editor/login-path 登錄密碼保護(hù)的方法了嗎?如果還想學(xué)到更多技能或想了解更多相關(guān)內(nèi)容,歡迎關(guān)注億速云行業(yè)資訊頻道,感謝各位的閱讀!

向AI問一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI