7 Ways to Check the MySQL Version on Linux

By Raju

December 5, 2016

MySQL, phpmyadmin, version

Are you trying to figure out which commands to execute to check MySQL Version on different Linux distributions like RedHat, CentOS, and Ubuntu?

Hold on a sec, Did you know the latest version of MySQL available for Linux? 

The current version of MySQL available for Linux is 5.7.6 

Let's explore different ways to check MySQL version installed on your server.

Requirements:

First, you need to login to the server as a root user.

Then you can execute any of the following commands to see MySQL version. However, some of the below methods don’t require Root logins.

Method 1:

Use below commands on any Linux distribution to see MySQL version.

# mysql --version
# mysql --version

Then you may see output similar to this.

mysql Ver 14.14 Distrib 5.5.52, for Linux (x86_64) using readline 5.1

Method 2:

In this method you can use MySQL Client Tools to find version details.

# mysql

You will be presented with complete MySQL server information like below.

You can see MySQL version in command output. It shows that present version version is Server version: 5.5.52-cll MySQL Community Server (GPL)

Welcome to the MySQL monitor. Commands end with ; or g.Your MySQL connection id is 24511746 Server version: 5.5.52-cll MySQL Community Server (GPL)Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names may be trademarks of their respective owners.Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.

mysql>

Method 3:

My favorite method to check MySQL version, configuration and RunTime variables.

MySQL admin tools

# mysqladmin version
# mysqladmin -V

You can see MySQL version, configuration, sockets, uptime and run time variables through one command.

mysqladmin Ver 8.42 Distrib 5.5.52, for Linux on x86_64 Copyright (c) 2000, 2016, 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 owners. Server version 5.5.52-cll Protocol version 10 Connection Localhost via UNIX socket UNIX socket /var/lib/mysql/mysql.sock Uptime: 33 days 17 hours 24 min 7 sec Threads: 5 Questions: 1400983490 Slow queries: 380 Opens: 59283070 Flush tables: 1 Open tables: 400 Queries per second avg: 480.802

Method 4:

If you know a little about MySQL queries and how to run them, then try these below commands.

First, login to mysql server using below command and then execute following queries.

# mysql

With the above command you'll get mysql server command line access as

mysql>
mysql> SELECT VERSION();
+————+ | VERSION() | +————+ | 5.5.52-cll | +————+ 1 row in set (0.00 sec)
mysql> SELECT VARIABLES LIKE “%version%”;
mysql> SHOW VARIABLES LIKE “%version%”; +————————-+——————————+ | Variable_name | Value | +————————-+——————————+ | innodb_version | 5.5.52 | | protocol_version | 10 | | slave_type_conversions | | | version | 5.5.52-cll | | version_comment | MySQL Community Server (GPL) | | version_compile_machine | x86_64 | | version_compile_os | Linux | +————————-+——————————+ 7 rows in set (0.00 sec)

Method 5:

If you installed PHPMyAdmin script to manage your MySQL database, then you’ll have access to all MySQL details through PHPMyAdmin tool GUI .

MySQL Version through phpmyadmin

Method 6:

If you are web developer and don’t have access to server ROOT, then create small PHP script and upload to server. Just run that PHP script to find MySQL version.

Through PHP Script functions:

mysqli::$server_info -- mysqli_get_server_info — Returns the version of the MySQL server

http://php.net/manual/en/mysqli.get-server-info.php

Method 7:

Let’s try differently for some time by using package manager commands.

We can search packages installed on server and find out installed MySQL packages. You can use this command on Linux distributions like RHEL/CentOS.

# yum info mysql-server
# rpm -qa | grep mysql

For Ubuntu servers, use below command

# dpkg -l 'mysql-server*'

Conclusion:

Now you are aware of different ways to check MySQL database server version on your VPS or dedicated boxes. All the above commands should work fine with any Linux flavors like Ubuntu, CentOS and RedHat. There are many other ways to see MySQL server version information but these methods are good enough for beginners.

Feel free to share your thoughts on this article through the comment box below. we'd be glad if it helps you. Thanks 🙂

Leave a Reply

Your email address will not be published. Required fields are marked

{"email":"Email address invalid","url":"Website address invalid","required":"Required field missing"}

Create a website in 3 simple steps

Choose a website template, add features, then customise! - Free Online Website builder.