How to Check MariaDB Version on Linux, Windows, and macOS (Complete Guide)

1. Introduction

MariaDB is a database management system that was created as a fork of MySQL and is widely used by many companies and developers. New features are added with each version, and security enhancements are continuously implemented. Therefore, it is extremely important to check which version of MariaDB you are currently using. In this article, we will explain in detail various methods to check the MariaDB version.

2. How to Check the MariaDB Version

Checking from the Command Line

Using the mysql Command

You can easily check the MariaDB version from the command line. First, here is the method using the mysql command.

mysql -V

When you run the above command, the MariaDB version information will be displayed. This method can be used regardless of the operating system, as long as MariaDB is installed in the environment.

Using the mysqladmin Command

The mysqladmin command is also convenient for checking the version.

mysqladmin -u username -p version

After entering the above command, you will be prompted for a password. Enter the appropriate password. The current MariaDB version will then be displayed.

Checking Using an SQL Query

If you are logged into MariaDB, you can also check the version using an SQL query.

SELECT VERSION();

When you execute this query, the current MariaDB version will be returned. Using an SQL query is convenient for developers because it allows quick verification while working inside the database.

Checking Using a Package Manager

Using the rpm Command

If you are using an RPM-based Linux distribution (e.g., CentOS), you can check the version with the rpm command as follows.

rpm -qa | grep mariadb

Using the dpkg Command

On Debian-based distributions (e.g., Ubuntu), you can check the installed MariaDB version using the dpkg command.

dpkg -l | grep mariadb

Checking from the Configuration File

In some cases, you can also check the version from the MariaDB configuration file (commonly the my.cnf file). However, since version information is often not directly written in the configuration file, this method is best used as a supplementary verification approach.

3. Procedures by Operating System

Linux

There are several methods to check the MariaDB version on Linux, but the most common approach is using the command line.

  1. mysql -V command: Simply running this command will display the version information.
  2. mysqladmin command: Useful as an administrative command.
  3. Using a package manager (rpm, dpkg): For users familiar with package management, the OS-specific method is convenient.

Windows

On Windows, you can check the MariaDB version using Command Prompt or PowerShell.

  1. mysql -V command: Run mysql -V in Command Prompt or PowerShell.
  2. Checking from the installation folder: Open the version.txt file in the MariaDB installation directory to view the version information.

macOS

If you are using MariaDB on macOS, you can check the version using the following methods.

  1. mysql -V command: Run it in Terminal to display the version.
  2. Homebrew: If MariaDB was installed via Homebrew, run the brew info mariadb command to see the installed version.

4. Notes and Troubleshooting

If you encounter issues while checking the MariaDB version, refer to the following troubleshooting tips.

If the Version Check Command Does Not Work

  • Verify that MariaDB is properly installed: If MariaDB is not installed, the command may not execute correctly.
  • Check the PATH environment variable: If the command is not recognized, the MariaDB installation path may not be included in the PATH environment variable. Verify the installation path and configure PATH if necessary.

If an Error Occurs When Running an SQL Query

  • Confirm database connection: When using an SQL query, make sure you are successfully logged into the database.
  • Check user permissions: The user account being used may not have permission to check the version. It is recommended to operate with an appropriate user account.

5. Summary

Checking the MariaDB version is extremely important for understanding system security and available features. By following the methods introduced in this article, you can easily verify the version in various environments. When updating your database or troubleshooting issues, always start by confirming the MariaDB version and proceed using the latest relevant information.