Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/67.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Mysql 显示全局状态的值_Mysql - Fatal编程技术网

Mysql 显示全局状态的值

Mysql 显示全局状态的值,mysql,Mysql,我在MySQL中运行这个命令 SHOW GLOBAL STATUS; 如何从一长串结果中只得到3个值 我可以使用SQL查询得到一些结果吗 我测试了这个: SHOW GLOBAL STATUS where variable_name='Bytes_received' and variable_name='Bytes_sent'; 尝试在 SHOW GLOBAL STATUS where variable_name IN ('Bytes_received','Bytes_sent'); 或者您

我在MySQL中运行这个命令

SHOW GLOBAL STATUS;
如何从一长串结果中只得到3个值

我可以使用SQL查询得到一些结果吗

我测试了这个:

SHOW GLOBAL STATUS where variable_name='Bytes_received' and variable_name='Bytes_sent';

尝试在

SHOW GLOBAL STATUS where variable_name IN ('Bytes_received','Bytes_sent');
或者您可以使用

SHOW GLOBAL STATUS WHERE variable_name='Bytes_received' or variable_name='Bytes_sent';
如果要将它们显示为列(例如

您可以尝试以下方法:

SELECT 
    a.variable_value AS 'Bytes_received',
    b.variable_value AS 'Bytes_sent'
FROM 
    information_schema.global_status a, 
    information_schema.global_status b
where 
    a.variable_name = 'Bytes_received'
and
    b.variable_name = 'Bytes_sent'

不过,它不是很漂亮,对于很多结果来说也不是很实用。(当然,它在5.7中不起作用,因为默认情况下禁用了information_schema表)

哪3个值?您可以使用
WHERE
。类似这样的内容:
显示全局状态,变量_name='Bytes'u received'和变量_name='Bytes'u sent';
如何将结果显示为列?我在上面添加了一个选项,可能会有所帮助?有其他方法获取此数据吗?如果您在谷歌上搜索类似“mysql Transport”的内容ose、pivot或unpivot“您将发现各种选项,其中大多数涉及
联合查询。这真的取决于您查看的行/列的数量吗?
SELECT 
    a.variable_value AS 'Bytes_received',
    b.variable_value AS 'Bytes_sent'
FROM 
    information_schema.global_status a, 
    information_schema.global_status b
where 
    a.variable_name = 'Bytes_received'
and
    b.variable_name = 'Bytes_sent'