In this tutorial, we will show you how to check the MySQL version on Linux. For those of you who didn’t know, MySQL (and its drop-in replacement MariaDB) is the most popular open-source relational database management system. It is a fast and secure relational database management system. MySQL is a free open-source relational database management system that uses SQL (structured query language). It is a necessary part of almost every open-source PHP tool. A few of the examples of PHP & MySQL-based scripts are WordPress, Joomla, Magento, and Drupal.
This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo
‘ to the commands to get root privileges. I will show you through the step-by-step checking of the MySQL/MariaDB version on Linux.
Prerequisites
- A server running one of the following operating systems: Linux.
- It’s recommended that you use a fresh OS install to prevent any potential issues.
- A
non-root sudo user
or access to theroot user
. We recommend acting as anon-root sudo user
, however, as you can harm your system if you’re not careful when acting as the root.
Check MySQL Version on Linux
Simply follow the below steps to check the MySQL version in Linux:
- Check MySQL Version From the Command Line
The MySQL server binary is named mysqld
. To get the server version run the binary using the --version
or -V
option:
mysqld --version
Output:
mysqld Ver 8.0.25-0ubuntu0.18.04.1 for Linux on x86_64 ((Ubuntu))
You can also check the MySQL or MariaDB database server version using the below command:
mysqladmin -V
The output will be slightly different from the previous command:
MySQL output: mysqladmin Ver 8.0.26-0ubuntu0.20.04 for Linux on x86_64 ((Ubuntu)) MariaDB output: mysqladmin Ver 9.1 Distrib 10.3.28-MariaDB, for Debian-linux-gnu on x86_64
- Check MySQL Version From the MySQL Shell
In this method, you can use MySQL Client Tools to find version details:
sudo mysql
Output:
Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 4 Server version: 8.0.28-0ubuntu0.20.04 (Ubuntu)
To get the information about the MySQL version and other components, query the version
variables:
mysql> SHOW VARIABLES LIKE "%version%";
Output:
+-------------------------+-------------------------+ | Variable_name | Value | +-------------------------+-------------------------+ | innodb_version | 5.8.14 | | protocol_version | 10 | | slave_type_conversions | | | tls_version | TLSv1,TLSv1.1 | | version | 8.0.28-0ubuntu0.20.04 | | version_comment | (Ubuntu) | | version_compile_machine | x86_64 | | version_compile_os | Linux | +-------------------------+-------------------------+
- Check MySQL Version Using the PHPMyAdmin Interface
If you aren’t familiar with running commands through ssh, you may have access to PHPMyAdmin on the server which gives a nice graphical interface for managing the databases. Login into your hosting account, and open up the PHP Admin, and look at the right side of the phpMyAdmin dashboard, there you can see a box named Database server:
Congratulations! You have successfully checked the MySQL version. Thanks for using this tutorial to Check the MySQL Version of a server. For additional help or useful information, we recommend you check the official MySQL website.