This short tutorial how to test MySQL MariaDB Server Edition in Ubuntu Linux.

How do you know which version of MySQL or MariaDB database server you are running? How do you know? Which command do you use?

The answers to all your questions are given below.

Nowadays, everywhere you see you are being used with many opensource projects like MarBDB database server. This was not so a few years ago.

MySQL, then, was probably the only database server used in most opensource projects. However, license changes made by Oracle, the new parent company installed an option for MySQL called MarBDB.

MariaDB is a drop-in replacement for MySQL. This means that for many cases, you can simply uninstall MySQL and install MariaDB and you are good to go. Generally there is no need to convert any data files.

Whichever database you use, the commands below should work in detecting the version of MySQL or MariaDB.


To get started with checking for MySQL or MariaDB database versions, follow the steps below:

Check mysql server version

MySQL and MariaDB come with a built-in tool that allows you to check server versions. Simply run the commands below with the -d argument to display the current version of the server.

mysqld --version

Running the above command will tell which version the server is running.

MySQL output:
/usr/sbin/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)

If you run the command below, the server version should also be displayed

mysqladmin -V

Output from the command given above.

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

MySQL and MariaDB come with client tools that should also help you find the server version. From the command line, invoke the client tool by running the command below:

sudo mysql

This will allow you to login and display server details including the version number.

Welcome to the MySQL monitor.  Commands end with ; or g.
Your MySQL connection id is 9
Server version: 8.0.23-0ubuntu0.20.04.1 (Ubuntu)
Copyright (c) 2000, 2021, Oracle and/or its affiliates.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective owners.
Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.

The MariaDB server will output the following message:

Welcome to the MariaDB monitor.  Commands end with ; or g.
Your MariaDB connection id is 49
Server version: 10.3.25-MariaDB-0ubuntu0.20.04.1 Ubuntu 20.04
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.
MariaDB [(none)]>

Or run a status query to display critical details, including the version number.

mysql> STATUS;

The output given below should be displayed:

Connection id:        9
 Current database:    
 Current user:        root@localhost
 SSL:            Not in use
 Current pager:        stdout
 Using outfile:        ''
 Using delimiter:    ;
 Server version:        8.0.23-0ubuntu0.20.04.1 (Ubuntu)
 Protocol version:    10
 Connection:        Localhost via UNIX socket
 Server characterset:    utf8mb4
 Db     characterset:    utf8mb4
 Client characterset:    utf8mb4
 Conn.  characterset:    utf8mb4
 UNIX socket:        /var/run/mysqld/mysqld.sock
 Binary data as:        Hexadecimal
 Uptime:            6 min 54 sec
 Threads: 2  Questions: 5  Slow queries: 0  Opens: 117  Flush tables: 3  Open tables: 36  Queries per second avg: 0.012

These methods are some that help you determine the server version of MySQL or MariaDB from the command line console.

Using PhpMyAdmin

If you have phpMyAdmin installed, you should also be able to view the server version from the portal. Login and view server details from the dashboard.

Using php

If you can upload the file to your web root directory, just create a local file mysqlversion.php. Then copy and paste the code below into the file and upload it to your server root folder.


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

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

// Close the connection.

Followed by the browser on the server hostname or IP address followed by mysqlversion.php


Which will display your server version.

There may be other ways to view your database server version number in Ubuntu Linux. However, above are some of the ways you should start.


This post showed you how to find the version number of MySQL or MariaDB database server in Ubuntu Linux.

You may also like the post below:

The right way to repair Bluetooth connectivity issues in Ubuntu Linux