Site icon DesignLinux

How to Check MySQL Version

How to Check the MySQL Version

MySQL is one of the most popular open-source RDBMS (Relational database management system). MySQL provides some features for particular version numbers and on particular platforms only, so knowing which version is running on your server is really important. In this quick tutorial, we’ll explain how to check the MySQL or MariaDB version on your server.

Using Command Line

The MySQL server binary is named mysqld. Run the binary using -V or --version to get the server version:

mysqld --version

In output you will see information about the MySQL version and exit.

mysqld Ver 5.7.30-0ubuntu0.18.04.1 for Linux on x86_64 ((Ubuntu))

In this example, MySQL server version is 5.7.30.

You also can use the mysqladmin is a client utility to check the version:

mysqladmin -V
mysqladmin Ver 8.42 Distrib 5.7.30, for Linux on x86_64

You will see some difference in output as compare to previous command.

From the MySQL Shell

You can use the MySQL Client Tools to find version details. To connect to the MySQL server simply type mysql:

mysql

The version will be display on screen once you connected to MySQL shell:

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.30-0ubuntu0.18.04.1 (Ubuntu)

If you would like to get more details about MySQL and it’s components, run command as following:

SHOW VARIABLES LIKE "%version%";
+-------------------------+-------------------------+
| Variable_name           | Value                   |
+-------------------------+-------------------------+
| innodb_version          | 5.7.30                  |
| protocol_version        | 10                      |
| slave_type_conversions  |                         |
| tls_version             | TLSv1,TLSv1.1,TLSv1.2   |
| version                 | 5.7.30-0ubuntu0.18.04.1 |
| version_comment         | (Ubuntu)                |
| version_compile_machine | x86_64                  |
| version_compile_os      | Linux                   |
+-------------------------+-------------------------+
8 rows in set (0.00 sec)

Another way to show the MySQL version details is using STATUS command:

STATUS;

From The PHPMyAdmin Interface

If you are not familiar with command line through ssh and have access to PhpMyAdmin on server then you can easily check the MySQL version. Once you will logged in on PhpMyAdmin, at right side you will see a box named “Database server”. In this box it will show server version of MySQL as given in following:

Using PHP

If you don’t have access to command line or PhpMyAdmin interface and running on shared hosting, you can check the version using PHP.

Create a new version.php PHP file and add following lines to it:

<?php

// Create a database connection.
$link = mysqli_connect("localhost", "MYSQL_USERNAME", "MYSQL_PASSWORD");

// Print the MySQL version.
echo mysqli_get_server_info($link);

// Close the connection.
mysqli_close($link);

Now upload this file to your document root directory using a FTP or SFTP client. Make sure you have to change MYSQL_USERNAME and MYSQL_PASSWORD with your real MySQL account details.

Open this file with your web browser and it will display MySQL version on screen.

5.7.30-0ubuntu0.18.04.1

Conclusion

In this tutorial, you have learned how to check the MySQL version with several different methods.

Feel free to leave a comment if you have any questions.

Exit mobile version