In this post, we are going to show that how to check MySQL or MariaDB Version in Linux including Ubuntu. If you want to check MySQL or MariaDB Version then this post is ideal for you.
MySQL is a most popular, non-profit(free) and open-source RDBMS (Relational database management system) that uses SQL(Structured Query Language). It is Fast and Secure relational database management system.
MySQL is open source, so if you want you can change its source code according to your need without paying a single money.
For more information about MySQL database, please check its official website.
How to Check MySQL or MariaDB Version in Linux
Simply follow below steps to check MySQL or MariaDB database versions in Linux including Ubuntu:
Method 1 : Check MySQL Version Using Command Line
MySQL and MariaDB come with a built-in tool that allows you to check the server versions. Run the mysqld
command with the -V
or --version
option to get the database server version:
mysqld --version
MySQL output:
mysqld Ver 8.0.23-0ubuntu0.20.04.1 for Linux on x86_64 ((Ubuntu))
MariaDB output:
mysqld Ver 10.3.25-MariaDB-0ubuntu0.20.04.1 for debian-linux-gnu on x86_64 (Ubuntu 20.04)
MySQL server version is 8.0.23
according to above output.
You can also check the MySQL or MariaDB database server version using below command:
mysqladmin -V
MySQL output:
mysqladmin Ver 8.0.23-0ubuntu0.20.04.1 for Linux on x86_64 ((Ubuntu))
MariaDB output:
mysqladmin Ver 9.1 Distrib 10.3.25-MariaDB, for Debian-linux-gnu on x86_64
Method 2 : Check MySQL Version From the MySQL Shell
mysql
is a command-line client utility(tool) and you can used it to check MySQL or MariaDB database server version as show below:
sudo mysql
The above command connect to the database server and display the server details with version number as show below:
Output
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 8.0.23-0ubuntu0.20.04.1 (Ubuntu)
For MariaDB server, it will display a output similar like below:
Output
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 25
Server version: 10.3.25-MariaDB-0ubuntu0.20.04.1 Ubuntu 20.04
STATUS query also help you to display the database server Version details with the information about the server status:
mysql> STATUS;
Method 3 : Using the PHPMyAdmin Interface
If you have installed phpMyAdmin in your Linux system then Login on phpMyAdmin dashboard and look at the right side of phpMyAdmin dashboard, there you can see a box named Database server:

Method 4 : Check MySQL Version using PHP
If you don’t have access to the command line or MySQL client like PHPMyAdmin then you can get the version of the database server using PHP.
To do that, create a php file named databaseversion.php. After that, copy and paste the code below into the php file. Replace the your_username
and your_password
with your actual database user account .
Now upload the databaseversion.php file in your website root directory using a FTP or SFTP file transfer client.
<?php
// Create a database connection.
$link = mysqli_connect("localhost", "your_username", "your_password");
// Print the MySQL version.
echo mysqli_get_server_info($link);
// Close the connection.
mysqli_close($link);
After that, open that php file in browser and it will displayed the version of the MySQL server on your screen.
http://localhost/databaseversion.php
That’s all
If you find any error and issue in above steps , please use comment box below to report.
If our tutorials helped you, please consider buying us a coffee. We appreciate your support!
Thank you for your support.