目次
1. Introduction
MariaDB is a database management system that originated as a fork of MySQL and is used by many companies and developers. New features are added with each version, and security is also strengthened. Therefore, it is crucial to verify which version of MariaDB you are running. This article provides a detailed explanation of various methods for checking the MariaDB version.2. How to Check MariaDB Version
Checking from the Command Line
mysql
Command Method
MariaDB version can be easily checked from the command line. First, using the mysql
command.mysql -V
Running the above command displays MariaDB version information. This method works on any OS as long as MariaDB is installed.mysqladmin
Command Method
The mysqladmin
command is also handy for checking the version.mysqladmin -u username -p version
After entering the command, you will be prompted for a password; enter the appropriate password. Then the current MariaDB version will be displayed.Checking Using an SQL Query
You can also check the version by running an SQL query while logged into MariaDB.SELECT VERSION();
Executing this query outputs the current MariaDB version. Using an SQL query is convenient for developers because it allows quick verification while working within the database.Checking Using a Package Manager
rpm Command
If you are using an RPM‑based Linux distribution (e.g., CentOS), you can check with therpm
command as follows.rpm -qa | grep mariadb
dpkg Command
On Debian‑based distributions (e.g., Ubuntu), you can use the <>dpkg command to check the installed MariaDB version.dpkg -l | grep mariadb
Checking from the Configuration File
You can sometimes determine the version from MariaDB’s configuration file (typically themy.cnf
file). However, because the version is often not explicitly listed, this should be used as a supplemental method.
3. Steps for Each Operating System
Linux
There are many ways to check the MariaDB version on Linux, but the most common method is using the command line.mysql -V
command: Just running this command displays the version information.mysqladmin
command: Convenient as an administrative command.- Using a package manager (rpm, dpkg): For users familiar with package management, this OS-specific method is convenient.
Windows
On Windows, you can check the MariaDB version using Command Prompt or PowerShell.mysql -V
command: Runmysql -V
in Command Prompt or PowerShell.- Check from the installation folder: Opening the
version.txt
file in the MariaDB installation directory shows the version information.
macOS
If you are using MariaDB on macOS, you can check the version using the following methods.mysql -V
command: Running it in Terminal displays the version.- Homebrew: If you installed MariaDB with Homebrew, running
brew info mariadb
shows the installed version.
4. Considerations and Troubleshooting
If you encounter issues while checking the MariaDB version, refer to the troubleshooting steps below.Version Check Command Not Working
- Verify that MariaDB is installed correctly: If MariaDB is not installed, the command may not run properly.
- Check the PATH: If the command is not recognized, the MariaDB installation path may not be included in the
PATH
environment variable. Verify the installation path and setPATH
as needed.
If an Error Occurs in an SQL Query
- Confirm database connection: When using an SQL query, first ensure you can log in to the database.
- Check permissions: The user you are using may not have permission to check the version, so it is recommended to operate with an appropriate user.