Find Out MySQL Version

in Categories , , last updated January 21, 2013

How do I find out mysql version under Linux or Unix operating systems?

To find out the version and release of your currently installed MySQL server installation, type any one of the following command:

[a] Sql commands

[b] mysql client

[c] The STATUS command

[d] The mysqladmin version command

[e] Package manger

Example: Sql commands

mysql -u root -p -e 'SHOW VARIABLES LIKE "%version%";'

Sample outputs:

Enter password: 
| Variable_name           | Value               |
| protocol_version        | 10                  |
| version                 | 5.1.66-log          |
| version_comment         | Source distribution |
| version_compile_machine | x86_64              |
| version_compile_os      | redhat-linux-gnu    |

Or type the following command:
mysql -u root -p -e ' SELECT VERSION(); '
Sample outputs:

Enter password: 
| VERSION()  |
| 5.1.66-log |

Example: STATUS command

Type the following command
mysql -u root -p -e 'STATUS'
Sample outputs:

Fig.01: Check Your MySQL Version - What Version of MySQL am I Running?
Fig.01: Check Your MySQL Version – What Version of MySQL am I Running?

Example: mysqladmin command

Type the following command:
mysqladmin -u root -p version

Enter password: 
mysqladmin  Ver 8.42 Distrib 5.1.66, for redhat-linux-gnu on x86_64
Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
Server version		5.1.66-log
Protocol version	10
Connection		Localhost via UNIX socket
UNIX socket		/var/lib/mysql/mysql.sock
Uptime:			44 days 56 min 47 sec

Examples: Package manger

Type the following command if you are using Fedora / RHEL / Red Hat / CentOS Linux:
$ rpm -qa | grep mysql
$ yum info mysql-server
Sample outputs:

Loaded plugins: auto-update-debuginfo, protectbase, rhnplugin
0 packages excluded due to repository protections
Installed Packages
Name        : mysql-server
Arch        : x86_64
Version     : 5.1.66
Release     : 2.el6_3
Size        : 25 M
Repo        : installed
From repo   : rhel-x86_64-server-6
Summary     : The MySQL server and related files
URL         :
License     : GPLv2 with exceptions
Description : MySQL is a multi-user, multi-threaded SQL database server. MySQL is a
            : client/server implementation consisting of a server daemon (mysqld)
            : and many different client programs and libraries. This package contains
            : the MySQL server and some accompanying files and directories.

If you are using Debian / Ubuntu Linux, type the following command:
$ dpkg --list | egrep 'mysql-(server|client)'
Sample outputs:

ii  mysql-client-5.1                         5.1.66-0+squeeze1                  MySQL database client binaries
ii  mysql-server-5.1                         5.1.66-0+squeeze1                  MySQL database server binaries and system database setup
ii  mysql-server-core-5.1                    5.1.66-0+squeeze1                  MySQL database server binaries

Posted by: Vivek Gite

The author is the creator of nixCraft and a seasoned sysadmin and a trainer for the Linux operating system/Unix shell scripting. He has worked with global clients and in various industries, including IT, education, defense and space research, and the nonprofit sector. Follow him on Twitter, Facebook, Google+.

Share this on (or read 0 comments/add one below):