How to Check the MySQL Version in Linux

July 11, 2019

Introduction

It is essential to know which version of MySQL you have installed.

Knowing the version number helps to determine if a specific feature is available or compatible with your system. This article provides five options to check your version of MySQL on Linux operating systems.

Commands to use in order to check MySQL vesion.

Prerequisites

  • Access to the command line/terminal window
  • Some operations require sudo or root privileges
  • MySQL or MySQL fork installed (forks: MariaDB, Percona Server )

Check MySQL Version with V Command

The easiest way to find the MySQL version is with the command:

mysql -V

The command mysql –V is not OS specific. This command works on Windows, OS X, and Linux distributions including Ubuntu.

MySQL client version 10.4.5-MariaDB

The MySQL client version in the example above is 10.4.5-MariaDB.

Note: The command provides the version of the MySQL client utility. The version could be the same as the MySQL server utility if installed on the same system as the server. However, if the client and server utilities are installed on different systems, they might not be the same.

How to Find Version Number with mysql Command

The MySQL command-line client is a simple SQL shell with input editing capabilities. You need to have administrative privileges or use the sudo command to gain access.

To access your MySQL client, use the command:

mysql

MySQL version data is available automatically once the MySQL client loads.

Output of the MySQL version data

The MySQL client shell offers a lot more options to retrieve detailed information about the version installed.

SHOW VARIABLES LIKE Statement

Now that you have accessed the MySQL client shell, statements can provide detailed information about your MySQL installation. Keep in mind that all text commands within the MySQL client must end with a semicolon “;”

Enter the following command:

SHOW VARIABLES LIKE ‘%version%’;
Determine version from within MySQL client.

The variable that contains MySQL version information is version.

SELECT VERSION Statement

It’s possible to obtain the version from within the MYSQL client by typing the SELECT VERSION() statement:

SELECT VERSION();
Check version from mysql client.

This command derives the data from the version variable disregarding other variables.

STATUS Command

The STATUS command displays the version as well as version comment information:

STATUS;

The output includes uptime (how long the MySQL server has been running), threads (the number of active threads), and other useful information.

Uptime and Threads in MariaDB with status command.

This statement provides the most comprehensive overview regarding the status of the MySQL installation and its current version.

Note: For other operating systems, read our guides Check the MySQL Version on Windows and Check MySQL Version on macOS.

Conclusion

You now know how to use the command line to check your MySQL version. Additionally, if you need to get a more detailed account of your MySQL version, this article explained how to display additional data from within the MySQL client.

Was this article helpful?
YesNo
Vladimir Kaplarevic
Vladimir is a resident Tech Writer at phoenixNAP. He has more than 7 years of experience in implementing e-commerce and online payment solutions with various global IT services providers. His articles aim to instill a passion for innovative technologies in others by providing practical advice and using an engaging writing style.
Next you should read
How to Improve MySQL Performance With Tuning
April 25, 2024

The performance of MySQL databases is an essential factor in the optimal operation of your server. Make sure...
Read more
How to Install MySQL 8.0 in Ubuntu 18.04
December 12, 2018

MySQL is an open-source relational database server tool for Linux operating systems. It is widely used in...
Read more
How to Back Up & Restore a MySQL Database
January 25, 2024

A MySQL database has been lost, and you're scrambling to restore a copy from your last backup. This guide...
Read more
How to Reset or Change MySQL Root Password on Linux or Windows
December 12, 2023

MySQL is a database management system. It's operated under the Open Source software model and has become a...
Read more