I know to check the Galera cluster status, the command that should be used after login to the mysql client is:


but, how to get the output directly from the command line?

The command below result in error:

[root@mariadb01 ~]# mysql -u root -p "SHOW STATUS LIKE 'wsrep%';"
Enter password:
ERROR 1049 (42000): Unknown database 'SHOW STATUS LIKE 'wsrep%';'

I plan to create a simple monitoring using cron and bash, thus the requirement to get the output using command line

1 Answer 1


After browsing the website http://www.fromdual.com/making-haproxy-high-available-for-mysql-galera-cluster , I found my own answer.

The answer to monitor Galera cluster status from command line is this command:

# mysql -u root -p<your_password> --exec="SHOW STATUS LIKE 'wsrep%';"


[root@mariadb01 ~]# mysql -u root -p<your_password> --exec="SHOW STATUS LIKE 'wsrep%';" |grep wsrep_local_state_comment
wsrep_local_state_comment       Synced
  • 1
    After running your example, I noticed the following message --> Info: Using unique option prefix 'exec' is error-prone and can break in the future. Please use the full name 'execute' instead. It might be better to use mysql -u root -p<your_password> --execute="SHOW STATUS LIKE 'wsrep%';"
    – Osh Mansor
    Jul 14, 2017 at 13:18
  • Things might have change from the time I found the solution. Thanks for mentioning about the message. Jul 22, 2017 at 16:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.