解決MySQL去除密碼登錄告警的問(wèn)題
背景
MySQL在命令行輸入密碼時(shí)會(huì)提示mysql: [Warning] Using a password on the command line interface can be insecure.
,在某些時(shí)候會(huì)干擾取值。
解決方法:
使用mysql_config_editor
可以解決這一問(wèn)題。
login-path是從MySQL5.6開始支持的特性,借助mysql_config_editor
工具可以將登陸MySQL的認(rèn)證信息加密存放在.mylogin.cnf
文件。之后,MySQL客戶端可以通過(guò)讀取該加密信息進(jìn)行登陸。
示例:
[root@localhost mysql]# mysql_config_editor set --login-path=db_admin --host=192.168.1.6 --user=root --password Enter password: # 輸入密碼
參數(shù)
–login-path=name 登陸信息名稱 –host=name 登陸地址 –password 在登陸文件中添加密碼(該密碼會(huì)被mysql_config_editor自動(dòng)加密) –user 用戶名 –port=name 端口 –socket=name sock文件
查看
# 顯示指定名稱的登陸信息 mysql_config_editor print --login-path=test # 顯示所有登陸信息 mysql_config_editor print --all
示例:
[root@localhost mysql]# mysql_config_editor print --all [db_admin] user = root password = ***** host = 192.168.1.6 [root@localhost mysql]# mysql_config_editor print --login-path=db_admin [db_admin] user = root password = ***** host = 192.168.1.6
刪除配置
mysql_config_editor remove --login-path=test
登陸
root@localhost mysql]# mysql --login-path=db_admin Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 10222 Server version: 5.7.37-log MySQL Community Server (GPL) Copyright (c) 2000, 2022, Oracle and/or its affiliates. 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>
到此這篇關(guān)于MySQL去除密碼登錄告警的文章就介紹到這了,更多相關(guān)MySQL密碼登錄告警內(nèi)容請(qǐng)搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!
相關(guān)文章
Mysql數(shù)據(jù)庫(kù)之索引優(yōu)化
MySQL憑借著出色的性能、低廉的成本、豐富的資源,已經(jīng)成為絕大多數(shù)互聯(lián)網(wǎng)公司的首選關(guān)系型數(shù)據(jù)庫(kù)。本文給大家介紹mysql數(shù)據(jù)庫(kù)之索引優(yōu)化,感興趣的朋友一起學(xué)習(xí)吧2016-03-03MySQL復(fù)合查詢操作實(shí)戰(zhàn)案例
這篇文章主要給大家介紹了關(guān)于MySQL復(fù)合查詢操作的相關(guān)資料,MySQL復(fù)合查詢是指在一個(gè)SQL語(yǔ)句中使用多個(gè)查詢條件,以過(guò)濾和檢索數(shù)據(jù),需要的朋友可以參考下2023-08-08mysql group_concat()函數(shù)用法總結(jié)
這篇文章主要介紹了mysql group_concat()函數(shù)用法,結(jié)合實(shí)例形式較為詳細(xì)的group_concat()函數(shù)的功能、使用方法與相關(guān)注意事項(xiàng),需要的朋友可以參考下2016-06-06MYSQL事務(wù)教程之Yii2.0商戶提現(xiàn)功能
這篇文章主要給大家介紹了關(guān)于MYSQL事務(wù)教程之Yii2.0商戶提現(xiàn)功能的相關(guān)資料,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面來(lái)一起學(xué)習(xí)學(xué)習(xí)吧2019-07-07MySQL運(yùn)維實(shí)戰(zhàn)使用RPM進(jìn)行安裝部署
這篇文章主要為大家介紹了MySQL運(yùn)維實(shí)戰(zhàn)使用RPM進(jìn)行安裝部署實(shí)現(xiàn)示例詳解,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪2023-12-12MySQL用命令行運(yùn)行sql文件的詳細(xì)圖文教程
最近重新踩了一下mysql 這邊的坑,記錄一下自己忽略的地方,下面這篇文章主要給大家介紹了關(guān)于MySQL用命令行運(yùn)行sql文件的詳細(xì)圖文教程,文中通過(guò)實(shí)例代碼的非常詳細(xì),需要的朋友可以參考下2023-01-01