Por ejemplo, si tenemos varios servidores y estamos actualizando mysql para acceder a nuevas mejoras de la nueva versión, necesitaremos saber la versión actual de mysql antes de proceder a la actualización.
[root@centos7 ~]$ mysql -V
mysql Ver 15.1 Distrib 5.5.64-MariaDB, for Linux (x86_64) using readline 5.1
[root@centos7 home]# mysql
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 8
Server version: 5.5.64-MariaDB MariaDB Server
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]>
[root@centos7 ~]$
MariaDB [(none)]> SHOW VARIABLES LIKE '%version%';
+-------------------------+----------------------+
| Variable_name | Value |
+-------------------------+----------------------+
| innodb_version | 5.5.61-MariaDB-38.13 |
| protocol_version | 10 |
| slave_type_conversions | |
| version | 5.5.64-MariaDB |
| version_comment | MariaDB Server |
| version_compile_machine | x86_64 |
| version_compile_os | Linux |
+-------------------------+----------------------+
7 rows in set (0.00 sec)
MariaDB [(none)]> SELECT VERSION();
+----------------+
| VERSION() |
+----------------+
| 5.5.64-MariaDB |
+----------------+
1 row in set (0.00 sec)
MariaDB [(none)]> STATUS;
--------------
mysql Ver 15.1 Distrib 5.5.64-MariaDB, for Linux (x86_64) using readline 5.1
Connection id: 9
Current database:
Current user: root@
SSL: Not in use
Current pager: stdout
Using outfile: ''
Using delimiter: ;
Server: MariaDB
Server version: 5.5.64-MariaDB MariaDB Server
Protocol version: 10
Connection: Localhost via UNIX socket
Server characterset: latin1
Db characterset: latin1
Client characterset: utf8
Conn. characterset: utf8
UNIX socket: /var/lib/mysql/mysql.sock
Uptime: 5 hours 57 min 34 sec
Threads: 3 Questions: 1552 Slow queries: 0 Opens: 6 Flush tables: 2 Open tables: 24 Queries per second avg: 0.072