hi How can i select just the position value from the 'SHOW MASTER STATUS' query exp something like
select position from (show master status);
thanks for your time and help
hi How can i select just the position value from the 'SHOW MASTER STATUS' query exp something like
select position from (show master status);
thanks for your time and help
Unfortunately, there is no direct table to query that info.
If you use PHP, you can retrieve it as follows:
$sql="SHOW MASTER STATUS";
$result = mysql_query($sql);
$row = mysql_fetch_assoc($result);
$pos = $row["Position"];
If you need it via shell scripting you do the following:
POS=`mysql -h... -u... -p... -A -skip-column-names -e"SHOW MASTER STATUS;" | awk '{print $2}'`
Give it a Try !!!
In Linux bash script you can try below command through mysql client to get the File and Position
For File:
mysql -u username -p password -h IP -P Port -e "show master status" | grep "File"| cut -d ":" -f2
For Position
mysql -u username -p password -h IP -P Port -e "show master status" | grep "Position"| cut -d ":" -f2