MySQL | Checking the Version

There are two ways to check the MySQL version: with a command or with a query.

Checking with a Command

$ cd /usr/local/mysql/bin
$ ./mysql -V
./mysql  Ver 14.14 Distrib 5.6.17, for osx10.7 (x86_64) using  EditLine wrapper

Or:

$ ./mysql --version
./mysql  Ver 14.14 Distrib 5.6.17, for osx10.7 (x86_64) using  EditLine wrapper

Strictly speaking, the commands above check the version of the MySQL client, so they also display information about the installed client.

Checking with a Query

Connect to the server and run the following query.

mysql> SELECT VERSION();
+-----------+
| VERSION() |
+-----------+
| 5.6.17    |
+-----------+
1 row in set (0.00 sec)

Or:

mysql> SHOW VARIABLES LIKE '%VERSION%';
+-------------------------+------------------------------+
| Variable_name           | Value                        |
+-------------------------+------------------------------+
| innodb_version          | 5.6.17                       |
| protocol_version        | 10                           |
| slave_type_conversions  |                              |
| version                 | 5.6.17                       |
| version_comment         | MySQL Community Server (GPL) |
| version_compile_machine | x86_64                       |
| version_compile_os      | osx10.7                      |
+-------------------------+------------------------------+
7 rows in set (0.00 sec)