.com 單個 enter 輸出重定向 解決方案 com air cut 輸出 問題:使用zabbix監控rds,用之前的腳本,執行總是會有密碼安全提示:
[[email protected] alertscripts]# sh rds.sh Uptime
mysqladmin: [Warning] Using a password on the command line interface can be insecure.
8784465
這樣
解決方案【按照一下直接修改腳本即可】:
1、使用mysql_config_editor
先創建一個login-path:
[[email protected] mysql]# mysql_config_editor set --login-path=rds --user=bzpt --password -hrm-2zee412l7n1r4air8.mysql.rds.aliyuncs.com -P3306
Enter password:
創建好後,.mylogin.cnf將保存在用戶的家目錄下,此處我用的是RHEL6,即/home/op下。
該文件是不可讀的,它類似於選項組,包含單個身份的驗證信息。
使用原來的方式,還是會有密碼安全提示:
[[email protected] mysql]# mysqladmin -ubzpt -pI9sGSa5IdJT6 -hrm-2zee412l7n1r4air8.mysql.rds.aliyuncs.com -P3306 status
mysqladmin: [Warning] Using a password on the command line interface can be insecure.
Uptime: 8784486 Threads: 22 Questions: 132212856 Slow queries: 2012 Opens: 175271 Flush tables: 1 Open tables: 599 Queries per second avg: 15.050
指定創建的login-path名,就沒有密碼安全提示了:
[[email protected]
/* */ mysql]# mysqladmin --login-path=rds status
Uptime: 8784531 Threads: 22 Questions: 132213030 Slow queries: 2012 Opens: 175271 Flush tables: 1 Open tables: 599 Queries per second avg: 15.050
mysql_config_editor用法:
http://blog.itpub.net/29773961/viewspace-1817640/
2、錯誤輸出重定向 2>/dev/null
[[email protected]