This brief tutorial shows students and new users how to check MySQL | MariaDB server versions in Ubuntu Linux.
How do you know which versions of MySQL or MariaDB database server you’re running? How do you find out? What command do you use?
The answer for all your questions detailed below.
Nowadays, everywhere you look you’ll find MariaDB database server being used with many opensource projects. This was not the case few years ago.
Then, MySQL was the probably the only database server used in majority of the opensource projects. However, licensing changes made by Oracle, the new parent company established an alternative to MySQL called MariaDB.
MariaDB is a drop-in replacement for MySQL. This means that for many cases, you can just uninstall MySQL and install MariaDB and you are good to go. There is not generally any need to convert any data files.
Whatever database you use, the commands below should work in finding out the version of MySQL or MariaDB.
To get started with checking 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 the server versions. Simply run the commands below with the -d argument to display the current version of the server.
Running the command above will show 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 commands below, is should also display the server version
Output from the command 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 tool that also should help you finding the server version. From the command line, invoke the client tool by running the command below:
That will allow you to login and display the server details including 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. mysql>
MariaDB server will output the message below:
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 the STATUS query to display the sever details including the version number.
That should display the output below:
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 few that help you determine the server version of MySQL or MariaDB from the command line console.
If you have phpMyAdmin installed, you should also be able to see the server version from the portal. Login and view the server detail from the dashboard.
If you can upload file to your web root directory, simply create a local file called mysqlversion.php. Then copy and paste the code below into the file and upload it to your server root folder.
<?php // Create a database connection. $link = mysqli_connect("localhost", "root", "root_password"); // Print the MySQL version. echo mysqli_get_server_info($link); // Close the connection. mysqli_close($link);
Then browser to the server hostname or IP address followed by mysqlversion.php
That will display your server version.
There might be other ways to view your database server version number in Ubuntu Linux. However, the few methods above should get you started.
This post showed you how to find the version number of MySQL or MariaDB database server in Ubuntu Linux. If you find any error above, please use the comment form below to report.
You may also like the post below: