It is an easy task to find MySQL variable values:
找到MySQL变量值很容易:
mysql> show variables where Variable_name = 'version'; +---------------+--------------------+ | Variable_name | Value | +---------------+--------------------+ | version | 5.0.19-Max | +---------------+--------------------+ 1 row in set (0.00 sec)
But is there any syntax that allows to select only column with variable value, like so:
但是有没有什么语法允许只选择具有变量值的列,比如:
mysql> command_i_want_to_know +--------------------+ | Value | +--------------------+ | 5.0.19-Max | +--------------------+ 1 row in set (0.00 sec)
2 个解决方案
#1
24
One more variant -
一个变种,
SELECT @@version;
#2
8
select variable_value
from information_schema.global_variables
where variable_name = 'version';
#1
24
One more variant -
一个变种,
SELECT @@version;
#2
8
select variable_value
from information_schema.global_variables
where variable_name = 'version';