I wanted to fetch only the value from status variables. Suppose the query is
show status where Variable_name='Aborted_clients'
It returns
+-----------------+-------+
| Variable_name | Value |
+-----------------+-------+
| Aborted_clients | 4 |
+-----------------+-------+
From here I need to fetch only the value of column "Value". Is there any way. When I am trying to this query as sub query, it is throwing error.
I am using MySQL version 5.0.24. And OS is windows
Go to information_schema database and do a select from the global_status table instead:
If you want to do it in a shell script, put a
~/.my.cnf
file in $HOME with belows content:If you are running MySQL on Windows, take a look at gawk:
Of course, you can use the following:
This will echo two tokens
I am not a Windows expert, but I do know something you will have to emulate from Linux.
The awk command is what you would need.
The problem is that awk does not exist in Windows batch language or in PowerShell. However, here is a nice blogpost on how to emulate it in Windows PowerShell.
I hope it helps.