How to Check the MySQL Version in Linux

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.

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.

原创文章,作者:kirin,如若转载,请注明出处:https://blog.ytso.com/223966.html

(0)
上一篇 2022年1月7日
下一篇 2022年1月7日

相关推荐

发表回复

登录后才能评论