Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to get states and variables in Mysql

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

Mysql how to obtain state and variables, for this problem, this article details the corresponding analysis and solution, hoping to help more small partners who want to solve this problem find a simpler and easier way.

#getMysqlEnv SLAVE_SATUS localhost root mysql "show status like 'Slave_running'";

#echo $SLAVE_SATUS

getMysqlEnv()

{

local l_statusVal="$1"

local l_Host="$2"

local l_UserName="$3"

local l_Pwd="$4"

shift 4

local l_cmd="$@"

local l_mysqlResult=""

l_mysqlResult=$(mysql -h${l_Host} -u${l_UserName} -p${l_Pwd} --skip_column_names -e "${l_cmd}")

l_mysqlResult=$(echo $l_mysqlResult | cut -f2 -d' ')

eval $l_statusVal=$l_mysqlResult

}

About Mysql how to get the state and variable questions to share here, I hope the above content can be of some help to everyone, if you still have a lot of doubts not solved, you can pay attention to the industry information channel to learn more related knowledge.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report