解決MySQL去除密碼登錄告警的問題
背景
MySQL在命令行輸入密碼時會提示mysql: [Warning] Using a password on the command line interface can be insecure.,在某些時候會干擾取值。
解決方法:
使用mysql_config_editor可以解決這一問題。
login-path是從MySQL5.6開始支持的特性,借助mysql_config_editor工具可以將登陸MySQL的認(rèn)證信息加密存放在.mylogin.cnf文件。之后,MySQL客戶端可以通過讀取該加密信息進(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 在登陸文件中添加密碼(該密碼會被mysql_config_editor自動加密) –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)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!
相關(guān)文章
開發(fā)人員為什么必須要了解數(shù)據(jù)庫鎖詳解
這篇文章主要給大家介紹了關(guān)于開發(fā)人員為什么必須要了解數(shù)據(jù)庫鎖的相關(guān)資料,文中通過示例代碼介紹的非常詳細(xì),對大家學(xué)習(xí)或者使用數(shù)據(jù)庫具有一定的參考學(xué)習(xí)價值,需要的朋友們下面來一起學(xué)習(xí)學(xué)習(xí)吧2019-03-03
安裝mysql-8.0.19-winx64遇到的問題:Can''t create directory ''xxxx\Da
這篇文章主要介紹了安裝mysql-8.0.19-winx64遇到的坑 ,Can't create directory 'xxxx\Database\',非常不錯,具有一定的參考借鑒價值,需要的朋友可以參考下2020-02-02
Mysql 存在多條數(shù)據(jù)時如何按時間取最新的那一組數(shù)據(jù)(思路詳解)
這篇文章主要介紹了Mysql 存在多條數(shù)據(jù)時如何按時間取最新的那一組數(shù)據(jù),本文給大家分享兩種思路結(jié)合實(shí)例代碼給大家介紹的非常詳細(xì),需要的朋友可以參考下2024-04-04
如何解決MySQL?this?is?incompatible?with?sql_mode=only_full_
MySQL的ONLY_FULL_GROUP_BY模式要求在使用GROUP?BY時,SELECT語句中引用的所有列必須在GROUP?BY子句中明確指定,或者是聚合函數(shù)的一部分,本文提供了修改SQL語句、使用聚合函數(shù)、禁用ONLY_FULL_GROUP_BY等解決方法,并強(qiáng)調(diào)了在禁用該模式時應(yīng)評估其影響2024-11-11
Linux(Ubuntu)下mysql5.7.17安裝配置方法圖文教程
這篇文章主要為大家詳細(xì)介紹了Linux下mysql5.7.17安裝配置方法圖文教程,具有一定的參考價值,感興趣的小伙伴們可以參考一下2017-01-01
MySQL中存儲的數(shù)據(jù)查詢的時候如何區(qū)分大小寫
這篇文章主要介紹了MySQL中存儲的數(shù)據(jù)查詢的時候如何區(qū)分大小寫問題,具有很好的參考價值,希望對大家有所幫助。如有錯誤或未考慮完全的地方,望不吝賜教2023-04-04

