天天看點

Using a password on the command line interface can be insecure.使用mysqldump遇到報錯mysqldump: [Warning] Using a password on the command line interface can be insecure.

使用mysqldump遇到報錯

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

該錯誤是提示mysqldump: [Warning]在指令行界面使用密碼可能是不安全的。

是mysql更新至5.6以後出現的安全保護方式

Using a password on the command line interface can be insecure.使用mysqldump遇到報錯mysqldump: [Warning] Using a password on the command line interface can be insecure.

主要原因這邊是在shell腳本上調用了mysqldump指令

mysqldump -u root -p 111111 庫名 > 路徑
           

注釋:111111是我的密碼

執行shell腳本後,提示報錯,腳本無法執行

解決辦法

首先打開my.cnf 配置檔案

不知道路徑的

# whereis my
my: /etc/my.cnf
           

打開配置檔案

在[mysqldump]下添加

user=root

password=111111

儲存退出

檢視效果

調用mysqldump指令時修改指令,将密碼去掉

mysqldump -u root -p  庫名 > 路徑
           

此時執行腳本時,會提示輸入密碼

Using a password on the command line interface can be insecure.使用mysqldump遇到報錯mysqldump: [Warning] Using a password on the command line interface can be insecure.

輸入mysql密碼即可執行成功

繼續閱讀