使用 LIKE 和 OR 显示多个字段的状态

问题描述 投票:0回答:1

我正在尝试显示 mysql 中两个变量的状态

$ sudo mysql -e "SHOW STATUS LIKE 'wsrep_local_state_comment' OR LIKE 'wsrep_cluster_size'"
ERROR 1064 (42000) at line 1: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'OR LIKE 'wsrep_cluster_size'' at line 1
$ sudo mysql -e "SHOW STATUS LIKE 'wsrep_local_state_comment' OR STATUS LIKE 'wsrep_cluster_size'"
ERROR 1064 (42000) at line 1: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'OR STATUS LIKE 'wsrep_cluster_size'' at line 1
$ sudo mysql -e "SHOW STATUS LIKE 'wsrep_local_state_comment' OR SHOW STATUS LIKE 'wsrep_cluster_size'"
ERROR 1064 (42000) at line 1: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'OR SHOW STATUS LIKE 'wsrep_cluster_size'' at line 1
$

mysql operators status
1个回答
0
投票

您需要添加

WHERE

SHOW STATUS WHERE variable_name IN ('x', 'y')

SHOW STATUS WHERE variable_name LIKE 'x' or variable_name LIKE 'y'
© www.soinside.com 2019 - 2024. All rights reserved.