Warning: Using a password on the command line inte

使用zabbix自帶模板對mysql進行監控時,發現mysql5.6以上版本在使用mysqladmin時會發出警告:「Warning: Using a password on the command line interface can be insecure.」 。這樣zabbix服務端獲取數值的時候,會帶有該字符串,致使報錯。mysql

最後實驗成功的方法是:將mysqladmin的警告信息重定向到/dev/null,忽略掉告警信息。sql

Com_select)ide

result=`/usr/bin/mysqladmin -u$MYSQL_USER -h$MYSQL_HOST -p${MYSQL_PWD} -S $MYSQL_SOCK extended-status  2>/dev/null|grep -w "Com_select"|cut -d"|" -f3`

            echo $result

            ;;

在原有命令中加上2>/dev/null 就好了。code

相關文章
相關標籤/搜索