mysql 消除 "[Warning] Using a password on the command line interface can be insecure"


如果將mysql密碼明文寫出來,進入的時候,系統前台會打印:

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

意思就是說,密碼露了,不安全。

我們執行腳本的時候,最好可以把這個東西干掉,否則一直彈彈彈,煩的要死。

於是我們可以:

 

1. 建立一個文件,存放用戶名、密碼

touch /etc/my.password

然后寫入下列內容:

[client]
user=root
password=密碼

 

2. 登錄時,不使用-u -p來指定,使用--defaults-extra-file=/etc/my.password來指定配置文件進行登錄,就可以消掉那行warning了。

mysql --defaults-extra-file=/etc/my.password


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM